From e33c6bfbdb78d78fedc0cd4917c24c0f4af973bd Mon Sep 17 00:00:00 2001 From: AngeloStatescu <35111313+AngeloStatescu@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:21:33 +0300 Subject: [PATCH] covered all element cases --- src/components/surfaces/Accordion/Accordion.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/surfaces/Accordion/Accordion.tsx b/src/components/surfaces/Accordion/Accordion.tsx index 545f35e6..02fc558c 100644 --- a/src/components/surfaces/Accordion/Accordion.tsx +++ b/src/components/surfaces/Accordion/Accordion.tsx @@ -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' @@ -18,12 +18,13 @@ const AccordionItem: React.FC = ({ return ( } {...summaryProps}> - {typeof title === 'string' && ( + {isValidElement(title) ? ( + title + ) : ( {title} )} - {typeof title !== 'string' && title} {content as ReactNode}