Skip to content

Commit

Permalink
covered all element cases
Browse files Browse the repository at this point in the history
  • Loading branch information
st-angelo committed Oct 16, 2023
1 parent 830d994 commit e33c6bf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/surfaces/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode, useState } from 'react'
import React, { ReactNode, useState, isValidElement } from 'react'
import PropTypes from 'prop-types'
import { Accordion as MuiAccordion, AccordionDetails } from '@mui/material/'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
Expand All @@ -18,12 +18,13 @@ const AccordionItem: React.FC<AccordionProps> = ({
return (
<MuiAccordion defaultExpanded={isBoolean(defaultExpanded) ? defaultExpanded : false} {...rest}>
<AccordionSummary variant={'standard' as AccordionVariant} expandIcon={<ExpandMoreIcon />} {...summaryProps}>
{typeof title === 'string' && (
{isValidElement(title) ? (
title
) : (
<Typography variant="subtitle1" color={'textPrimary'}>
{title}
</Typography>
)}
{typeof title !== 'string' && title}
</AccordionSummary>
<AccordionDetails {...detailsProps}>{content as ReactNode}</AccordionDetails>
</MuiAccordion>
Expand Down

0 comments on commit e33c6bf

Please sign in to comment.