Skip to content

Commit

Permalink
menu accordion are always default open
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalabbad committed Oct 30, 2024
1 parent 3d81109 commit 98e34c0
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ const RecursiveObjectMenuItem: React.FC<{
item: MenuItem;
isCollapsed?: boolean;
level?: number;
menuLength?: number;
}> = ({ item, isCollapsed, menuLength, level = 0 }) => {
}> = ({ item, isCollapsed, level = 0 }) => {
if (!item.children?.length) {
return (
<DropdownMenuItem className={menuNavigationItemStyle} asChild>
Expand All @@ -47,10 +46,7 @@ const RecursiveObjectMenuItem: React.FC<{
}

return (
<DropdownMenuAccordion
value={item.identifier}
defaultOpen={menuLength === 1 || item.children.length < 2}
>
<DropdownMenuAccordion value={item.identifier} defaultOpen>
<DropdownMenuAccordionTrigger
className={classNames(menuNavigationItemStyle, "font-bold py-1")}
iconClassName="hover:bg-neutral-200 group-data-[state=open]:hover:bg-indigo-200"
Expand Down Expand Up @@ -117,12 +113,7 @@ const TopLevelMenuItem: React.FC<{
>
<h3 className="text-xl font-medium text-neutral-800 mb-5">{item.label}</h3>
{item.children.map((child) => (
<RecursiveObjectMenuItem
key={child.identifier}
item={child}
isCollapsed={isCollapsed}
menuLength={item.children?.length}
/>
<RecursiveObjectMenuItem key={child.identifier} item={child} isCollapsed={isCollapsed} />
))}
</DropdownMenuContent>
</DropdownMenu>
Expand Down

0 comments on commit 98e34c0

Please sign in to comment.