1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-13 13:48:59 +02:00

chore: align recently used constraints to designs (#9904)

Now both of the recents have aligned styling.
Now ConstraintAccordionView accepts dashed and solid borders.


![image](https://github.com/user-attachments/assets/89fefaf5-4acc-41b0-aa7b-efb1d5e1eb63)
This commit is contained in:
Jaanus Sellin 2025-05-06 15:42:38 +03:00 committed by GitHub
parent 8d377f76b7
commit 8e05c92440
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -26,10 +26,17 @@ interface IConstraintAccordionViewProps {
compact?: boolean;
disabled?: boolean;
renderAfter?: JSX.Element;
borderStyle?: 'solid' | 'dashed';
}
const StyledAccordion = styled(Accordion)(({ theme }) => ({
border: `1px solid ${theme.palette.divider}`,
interface StyledAccordionProps {
borderStyle?: 'solid' | 'dashed';
}
const StyledAccordion = styled(Accordion, {
shouldForwardProp: (prop) => prop !== 'borderStyle',
})<StyledAccordionProps>(({ theme, borderStyle = 'solid' }) => ({
border: `1px ${borderStyle} ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadiusMedium,
boxShadow: 'none',
margin: 0,
@ -73,6 +80,7 @@ export const ConstraintAccordionView = ({
compact = false,
disabled = false,
renderAfter,
borderStyle = 'solid',
}: IConstraintAccordionViewProps) => {
const [expandable, setExpandable] = useState(true);
const [expanded, setExpanded] = useState(false);
@ -88,7 +96,7 @@ export const ConstraintAccordionView = ({
};
return (
<StyledAccordion expanded={expanded} sx={sx}>
<StyledAccordion expanded={expanded} sx={sx} borderStyle={borderStyle}>
<StyledAccordionSummary
expandIcon={null}
onClick={handleClick}

View File

@ -41,6 +41,7 @@ export const RecentlyUsedConstraints = ({
<ConstraintAccordionView
key={constraint[constraintId]}
constraint={constraint}
borderStyle='dashed'
onUse={() => {
setConstraints((prev) => [...prev, constraint]);
}}