From 99f6696fa2d3d3241971f2d5106d838d079b5f1e Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Sun, 30 Mar 2025 20:43:12 +0800 Subject: [PATCH] feat(nav-main): refactor sidebar menu to handle items without submenus --- src/components/nav-main.tsx | 71 +++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/components/nav-main.tsx b/src/components/nav-main.tsx index 934e626..7706335 100644 --- a/src/components/nav-main.tsx +++ b/src/components/nav-main.tsx @@ -30,44 +30,53 @@ export interface NavMainProps { }[]; } -export function NavMain({ - items, -}: NavMainProps) { +export function NavMain({ items }: NavMainProps) { return ( Platform - {items.map((item) => ( - - - - + {items.map((item) => + !item.items ? ( + + + {item.icon && } {item.title} - - - - - - {item.items?.map((subItem) => ( - - - - {subItem.title} - - - - ))} - - + + - - ))} + ) : ( + + + + + {item.icon && } + {item.title} + + + + + + {item.items.map((subItem) => ( + + + + {subItem.title} + + + + ))} + + + + + ) + )} );