1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00
unleash.unleash/frontend/src/component/common/NewConstraintAccordion/ConstraintIcon.tsx
Fredrik Strand Oseberg d6afe69a0f
Fix/constraint accordion autosave (#5825)
This PR adds autosave to the constraint accordion which means that when
you add values to it, it will automatically save the constraint locally.
If you unmount the constraint component without any valid values, it
will remove the constraint from the list.
2024-01-10 11:48:15 +01:00

36 lines
991 B
TypeScript

import { VFC } from 'react';
import { Box } from '@mui/material';
import { TrackChanges } from '@mui/icons-material';
interface IConstraintIconProps {
compact?: boolean;
disabled?: boolean;
}
export const ConstraintIcon: VFC<IConstraintIconProps> = ({
compact,
disabled,
}) => (
<Box
sx={(theme) => ({
backgroundColor: disabled
? theme.palette.neutral.border
: 'primary.light',
p: compact ? '1px' : '2px',
borderRadius: '50%',
width: compact ? '18px' : '24px',
height: compact ? '18px' : '24px',
marginRight: '13px',
})}
>
<TrackChanges
sx={(theme) => ({
fill: theme.palette.common.white,
display: 'block',
width: compact ? theme.spacing(2) : theme.spacing(2.5),
height: compact ? theme.spacing(2) : theme.spacing(2.5),
})}
/>
</Box>
);