From abca91c26a5f888593c13d88ab8dd358cb36cf3b Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Sun, 11 May 2025 10:39:09 +0800 Subject: [PATCH] "introduce horizontal main navigation component with dynamic styling and interactive elements" --- .../{main-nav.tsx => main-nav/index.tsx} | 134 +++++++++++++++--- 1 file changed, 112 insertions(+), 22 deletions(-) rename 002_source/cms/src/components/dashboard/layout/horizontal/{main-nav.tsx => main-nav/index.tsx} (84%) diff --git a/002_source/cms/src/components/dashboard/layout/horizontal/main-nav.tsx b/002_source/cms/src/components/dashboard/layout/horizontal/main-nav/index.tsx similarity index 84% rename from 002_source/cms/src/components/dashboard/layout/horizontal/main-nav.tsx rename to 002_source/cms/src/components/dashboard/layout/horizontal/main-nav/index.tsx index 71acbe5..f679fca 100644 --- a/002_source/cms/src/components/dashboard/layout/horizontal/main-nav.tsx +++ b/002_source/cms/src/components/dashboard/layout/horizontal/main-nav/index.tsx @@ -92,7 +92,11 @@ export function MainNav({ color = 'evident', items = [] }: MainNavProps): React. py: 1, }} > - + { setOpenNav(true); @@ -101,8 +105,16 @@ export function MainNav({ color = 'evident', items = [] }: MainNavProps): React. > - - + + @@ -154,11 +166,17 @@ function SearchButton(): React.JSX.Element { return ( - + - + ); } @@ -174,12 +192,19 @@ function NotificationsButton(): React.JSX.Element { sx={{ '& .MuiBadge-dot': { borderRadius: '50%', height: '10px', right: '6px', top: '6px', width: '10px' } }} variant="dot" > - + - + ); } @@ -190,11 +215,18 @@ function ContactsButton(): React.JSX.Element { return ( - + - + ); } @@ -214,11 +246,20 @@ function LanguageSwitch(): React.JSX.Element { sx={{ display: { xs: 'none', md: 'inline-flex' } }} > - + - + ); } @@ -259,7 +300,11 @@ function UserButton(): React.JSX.Element { - + ); } @@ -267,7 +312,11 @@ function UserButton(): React.JSX.Element { function renderNavGroups({ items = [], pathname }: { items?: NavItemConfig[]; pathname: string }): React.JSX.Element { const children = items.reduce((acc: React.ReactNode[], curr: NavItemConfig): React.ReactNode[] => { acc.push( - + {renderNavItems({ pathname, items: curr.items })} ); @@ -276,7 +325,12 @@ function renderNavGroups({ items = [], pathname }: { items?: NavItemConfig[]; pa }, []); return ( - + {children} ); @@ -286,13 +340,24 @@ function renderNavItems({ items = [], pathname }: { items?: NavItemConfig[]; pat const children = items.reduce((acc: React.ReactNode[], curr: NavItemConfig): React.ReactNode[] => { const { key, ...item } = curr; - acc.push(); + acc.push( + + ); return acc; }, []); return ( - + {children} ); @@ -318,7 +383,10 @@ function NavItem({ const isBranch = Boolean(items); const element = ( - + - {label ? : null} + {label ? ( + + ) : null} {external ? ( - + ) : null} {isBranch ? ( @@ -415,13 +492,23 @@ function renderDropdownItems({ const children = items.reduce((acc: React.ReactNode[], curr: NavItemConfig): React.ReactNode[] => { const { key, ...item } = curr; - acc.push(); + acc.push( + + ); return acc; }, []); return ( - + {children} ); @@ -444,7 +531,10 @@ function DropdownItem({ const isBranch = Boolean(items); const element = ( - +