Fixed sidebar not closing when searching

This commit is contained in:
Lucas Oliveira 2023-10-25 20:01:49 -03:00
commit b691237d77
2 changed files with 3 additions and 5 deletions

View file

@ -8,7 +8,7 @@ export default function DisclosureComponent({
openDisc, openDisc,
}: DisclosureComponentType): JSX.Element { }: DisclosureComponentType): JSX.Element {
return ( return (
<Disclosure as="div" key={title}> <Disclosure as="div" defaultOpen={openDisc} key={title}>
{({ open }) => ( {({ open }) => (
<> <>
<div> <div>
@ -34,9 +34,7 @@ export default function DisclosureComponent({
</div> </div>
</Disclosure.Button> </Disclosure.Button>
</div> </div>
<Disclosure.Panel as="div" static={openDisc}> <Disclosure.Panel as="div">{children}</Disclosure.Panel>
{children}
</Disclosure.Panel>
</> </>
)} )}
</Disclosure> </Disclosure>

View file

@ -228,7 +228,7 @@ export default function ExtraSidebar(): JSX.Element {
Object.keys(dataFilter[SBSectionName]).length > 0 ? ( Object.keys(dataFilter[SBSectionName]).length > 0 ? (
<DisclosureComponent <DisclosureComponent
openDisc={search.length == 0 ? false : true} openDisc={search.length == 0 ? false : true}
key={index} key={index + search}
button={{ button={{
title: nodeNames[SBSectionName] ?? nodeNames.unknown, title: nodeNames[SBSectionName] ?? nodeNames.unknown,
Icon: Icon: