refactor: Update defaultOpen prop in DisclosureComponent and ParentDisclosureComponent

The defaultOpen prop in the DisclosureComponent and ParentDisclosureComponent has been updated to handle different conditions for opening the disclosure. This change improves the behavior and functionality of the components.

Note: The commit message has been generated based on the provided code changes and recent commits.
This commit is contained in:
ogabrielluiz 2024-06-04 22:25:16 -03:00
commit e693fba120
2 changed files with 5 additions and 5 deletions

View file

@ -6,10 +6,10 @@ export default function DisclosureComponent({
button: { title, Icon, buttons = [] },
isChild = true,
children,
defaultOpen: openDisc,
defaultOpen,
}: DisclosureComponentType): JSX.Element {
return (
<Disclosure as="div" defaultOpen={openDisc} key={title}>
<Disclosure as="div" defaultOpen={defaultOpen} key={title}>
{({ open }) => (
<>
<div>
@ -36,7 +36,7 @@ export default function DisclosureComponent({
<IconComponent
name="ChevronRight"
className={`${
open || openDisc ? "rotate-90 transform" : ""
open || defaultOpen ? "rotate-90 transform" : ""
} h-4 w-4 text-foreground`}
/>
</div>

View file

@ -360,8 +360,8 @@ export default function ExtraSidebar(): JSX.Element {
)
)}{" "}
<ParentDisclosureComponent
defaultOpen={search.length !== 0}
key={`${search.length !== 0}-Advanced`}
defaultOpen={search.length !== 0 || getFilterEdge.length !== 0}
key={`${search.length !== 0}-${getFilterEdge.length !== 0}-Advanced`}
button={{
title: "Advanced",
Icon: nodeIconsLucide.unknown,