'use client'; import styles from '@components/Accordion.module.css'; import * as React from 'react'; import * as Utilities from '@common/utilities'; import Row from '@components/Row'; interface AccordionProps { defaultValue?: boolean; title: string; children?: React.ReactNode; } const Accordion: React.FC = ({ defaultValue = false, title, children }) => { const [show, setShow] = React.useState(defaultValue); const accordionRef = React.useRef(null); const toggleShow = (): void => { setShow((prevShow) => !prevShow); }; return ( <> { if (e.key === 'Enter' || e.key === ' ') { if (e.key === ' ') e.preventDefault(); toggleShow(); } }} aria-expanded={show}>
{show ? '▾' : '▸'} {title}
{show && {children}} ); }; export default Accordion;