Skip to content

Commit

Permalink
Merge pull request #76 from osstotalsoft/accordion-remove-typography-…
Browse files Browse the repository at this point in the history
…title-wrap

Remove Typography title wrap in Accordion
  • Loading branch information
st-angelo authored Oct 16, 2023
2 parents 4c75971 + 2a9534c commit eb003cb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 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,13 +18,15 @@ const AccordionItem: React.FC<AccordionProps> = ({
return (
<MuiAccordion defaultExpanded={isBoolean(defaultExpanded) ? defaultExpanded : false} {...rest}>
<AccordionSummary variant={'standard' as AccordionVariant} expandIcon={<ExpandMoreIcon />} {...summaryProps}>
<Typography variant="subtitle1" color={'textPrimary'}>
{title}
</Typography>
{isValidElement(title) ? (
title
) : (
<Typography variant="subtitle1" color={'textPrimary'}>
{title}
</Typography>
)}
</AccordionSummary>
<AccordionDetails {...detailsProps}>
{content as ReactNode}
</AccordionDetails>
<AccordionDetails {...detailsProps}>{content as ReactNode}</AccordionDetails>
</MuiAccordion>
)
}
Expand Down

0 comments on commit eb003cb

Please sign in to comment.