Skip to content

Commit

Permalink
feat/SOF-7224 (#62)
Browse files Browse the repository at this point in the history
* fix: accordion custom header conditional rendering fixed

* chore: accordion props types improved
  • Loading branch information
seankwarren committed Feb 28, 2024
1 parent 30a491e commit 813c20a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/mui/components/accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ const AccordionSummary = withStyles({
})(MuiAccordionSummary);

export interface AccordionProps {
hideExpandIcon: boolean;
children: React.ReactNode;
hideExpandIcon?: boolean;
children?: React.ReactNode;
isExpanded: boolean;
header: React.ReactNode;
alternativeComponent: React.ReactNode;
header?: React.ReactNode;
renderSummary?: React.ReactNode;
}

export default function Accordion({
hideExpandIcon,
children,
isExpanded,
header,
alternativeComponent,
renderSummary,
...restProps
}: AccordionProps) {
const [isExpanded_, setIsExpanded] = useState(isExpanded);
Expand All @@ -78,8 +78,7 @@ export default function Accordion({
onClick={handleToggleExpanded}
aria-controls="panel2a-content"
expandIcon={!hideExpandIcon && <IconByName name="actions.expand" />}>
<Typography variant="overline">{header}</Typography>
{alternativeComponent}
{renderSummary || <Typography variant="overline">{header}</Typography>}
</AccordionSummary>
<Divider />
<AccordionDetails>{children}</AccordionDetails>
Expand Down

0 comments on commit 813c20a

Please sign in to comment.