1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00
unleash.unleash/frontend/src/component/changeRequest/ChangeRequest/Changes/FeatureToggleChanges.tsx
Gastón Fournier abe160eb7d
feat: Unleash v7 ESM migration (#9877)
We're migrating to ESM, which will allow us to import the latest
versions of our dependencies.

Co-Authored-By: Christopher Kolstad <chriswk@getunleash.io>
2025-05-14 09:47:12 +02:00

76 lines
2.2 KiB
TypeScript

import type React from 'react';
import type { FC } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { Box, Card, Typography, Link } from '@mui/material';
import { ConflictWarning } from './Change/ConflictWarning.tsx';
interface IFeatureToggleChanges {
featureName: string;
projectId: string;
conflict?: string;
onNavigate?: () => void;
children?: React.ReactNode;
}
export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
featureName,
projectId,
conflict,
onNavigate,
children,
}) => (
<Card
elevation={0}
sx={(theme) => ({
marginTop: theme.spacing(2),
overflow: 'hidden',
})}
>
<Box
sx={(theme) => ({
backgroundColor: conflict
? theme.palette.neutral.light
: theme.palette.neutral.light,
borderRadius: (theme) =>
`${theme.shape.borderRadiusLarge}px ${theme.shape.borderRadiusLarge}px 0 0`,
border: '1px solid',
borderColor: (theme) =>
conflict
? theme.palette.warning.border
: theme.palette.divider,
borderBottom: 'none',
overflow: 'hidden',
})}
>
<ConflictWarning conflict={conflict} />
<Box
sx={{
display: 'flex',
pt: conflict ? 0 : 2,
pb: 2,
px: 3,
}}
>
<Typography>Feature flag name: </Typography>
<Link
component={RouterLink}
to={`/projects/${projectId}/features/${featureName}`}
color='primary'
underline='hover'
sx={{
marginLeft: 1,
'& :hover': {
textDecoration: 'underline',
},
}}
onClick={onNavigate}
>
<strong>{featureName}</strong>
</Link>
</Box>
</Box>
<Box>{children}</Box>
</Card>
);