diff --git a/packages/ui/src/shadcn/sidebar.tsx b/packages/ui/src/shadcn/sidebar.tsx index f3f9c9be1..7bade3c77 100644 --- a/packages/ui/src/shadcn/sidebar.tsx +++ b/packages/ui/src/shadcn/sidebar.tsx @@ -17,7 +17,11 @@ import { If } from '../makerkit/if'; import type { SidebarConfig } from '../makerkit/sidebar'; import { Trans } from '../makerkit/trans'; import { Button } from './button'; -import { CollapsibleTrigger } from './collapsible'; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from './collapsible'; import { Input } from './input'; import { Separator } from './separator'; import { Sheet, SheetContent } from './sheet'; @@ -842,8 +846,17 @@ export function SidebarNavigation({ } if ('children' in item) { + const Container = item.collapsible ? Collapsible : Fragment; + const ContentContainer = item.collapsible + ? CollapsibleContent + : Fragment; + return ( - + - - - {item.children.map((child) => { - const isActive = isRouteActive( - child.path, - currentPath, - child.end, - ); + + + + {item.children.map((child) => { + const isActive = isRouteActive( + child.path, + currentPath, + child.end, + ); - return ( - - - svg]:flex-1': - minimized, - })} - href={child.path} + return ( + + - {child.Icon} - - - - - - - - - {(children) => ( - - {children.map((child) => { - const isActive = isRouteActive( - child.path, - currentPath, - child.end, - ); - - return ( - - - svg]:flex-1': - minimized, - })} - href={child.path} - > - {child.Icon} - - - - - - - - ); + svg]:flex-1': + minimized, })} - - )} - - - ); - })} - - + href={child.path} + > + {child.Icon} + + + + + + + + + {(children) => ( + + {children.map((child) => { + const isActive = isRouteActive( + child.path, + currentPath, + child.end, + ); + + return ( + + + svg]:flex-1': + minimized, + })} + href={child.path} + > + {child.Icon} + + + + + + + + ); + })} + + )} + + + ); + })} + + + - + ); } })}