import Accordion from 'react-bootstrap/Accordion' import AccordionContext from 'react-bootstrap/AccordionContext' import { useAccordionButton } from 'react-bootstrap/AccordionButton' import ArrowRight from '@/svgs/arrow-right-s-fill.svg' import ArrowDown from '@/svgs/arrow-down-s-fill.svg' import { useContext, useEffect, useState } from 'react' import classNames from 'classnames' const KEY_ID = '0' function ContextAwareToggle ({ children, headerColor = 'var(--theme-grey)', eventKey, show }) { const { activeEventKey } = useContext(AccordionContext) const decoratedOnClick = useAccordionButton(eventKey) useEffect(() => { // if we want to show the accordian and it's not open, open it if (show && activeEventKey !== eventKey) { decoratedOnClick() } }, [show]) const isCurrentEventKey = activeEventKey === eventKey return (