mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-18 11:14:57 +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. 
This commit is contained in:
parent
8d377f76b7
commit
8e05c92440
@ -26,10 +26,17 @@ interface IConstraintAccordionViewProps {
|
|||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
renderAfter?: JSX.Element;
|
renderAfter?: JSX.Element;
|
||||||
|
borderStyle?: 'solid' | 'dashed';
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledAccordion = styled(Accordion)(({ theme }) => ({
|
interface StyledAccordionProps {
|
||||||
border: `1px solid ${theme.palette.divider}`,
|
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,
|
borderRadius: theme.shape.borderRadiusMedium,
|
||||||
boxShadow: 'none',
|
boxShadow: 'none',
|
||||||
margin: 0,
|
margin: 0,
|
||||||
@ -73,6 +80,7 @@ export const ConstraintAccordionView = ({
|
|||||||
compact = false,
|
compact = false,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
renderAfter,
|
renderAfter,
|
||||||
|
borderStyle = 'solid',
|
||||||
}: IConstraintAccordionViewProps) => {
|
}: IConstraintAccordionViewProps) => {
|
||||||
const [expandable, setExpandable] = useState(true);
|
const [expandable, setExpandable] = useState(true);
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
@ -88,7 +96,7 @@ export const ConstraintAccordionView = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledAccordion expanded={expanded} sx={sx}>
|
<StyledAccordion expanded={expanded} sx={sx} borderStyle={borderStyle}>
|
||||||
<StyledAccordionSummary
|
<StyledAccordionSummary
|
||||||
expandIcon={null}
|
expandIcon={null}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
@ -41,6 +41,7 @@ export const RecentlyUsedConstraints = ({
|
|||||||
<ConstraintAccordionView
|
<ConstraintAccordionView
|
||||||
key={constraint[constraintId]}
|
key={constraint[constraintId]}
|
||||||
constraint={constraint}
|
constraint={constraint}
|
||||||
|
borderStyle='dashed'
|
||||||
onUse={() => {
|
onUse={() => {
|
||||||
setConstraints((prev) => [...prev, constraint]);
|
setConstraints((prev) => [...prev, constraint]);
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user