1- import { Anchor , Box , Burger , Divider , Drawer , Group , Stack , Text } from '@mantine/core' ;
1+ import { Anchor , Box , Burger , Drawer , Group , Stack , Text } from '@mantine/core' ;
22import { colors , spacing , typography } from '@/designTokens' ;
33import CountrySelector from './CountrySelector' ;
4-
5- interface NavLink {
6- label : string ;
7- path ?: string ;
8- }
4+ import { NavItemSetup } from './NavItem' ;
95
106interface MobileMenuProps {
117 opened : boolean ;
128 onOpen : ( ) => void ;
139 onClose : ( ) => void ;
14- navLinks : NavLink [ ] ;
15- aboutLinks : NavLink [ ] ;
16- onNavClick : ( path ?: string ) => void ;
10+ navItems : NavItemSetup [ ] ;
1711}
1812
19- export default function MobileMenu ( {
20- opened,
21- onOpen,
22- onClose,
23- navLinks,
24- aboutLinks,
25- onNavClick,
26- } : MobileMenuProps ) {
13+ export default function MobileMenu ( { opened, onOpen, onClose, navItems } : MobileMenuProps ) {
2714 return (
2815 < >
2916 { /* Mobile Burger Menu with Country Selector */ }
@@ -45,56 +32,53 @@ export default function MobileMenu({
4532 closeButtonProps = { { style : { color : colors . text . inverse } , size : 'md' } }
4633 >
4734 < Stack gap = { spacing . lg } p = { spacing . lg } >
48- { /* About Section */ }
49- < Box >
50- < Text
51- c = { colors . text . inverse }
52- fw = { typography . fontWeight . medium }
53- size = "sm"
54- mb = { spacing . xs }
55- style = { { fontFamily : typography . fontFamily . primary } }
56- >
57- About
58- </ Text >
59- < Stack gap = { spacing . xs } pl = { spacing . md } >
60- { aboutLinks . map ( ( link ) => (
61- < Anchor
62- key = { link . label }
35+ { navItems . map ( ( item ) =>
36+ item . hasDropdown && item . dropdownItems ? (
37+ // Render dropdown as a section
38+ < Box key = { item . label } >
39+ < Text
6340 c = { colors . text . inverse }
64- variant = "subtle"
65- td = "none"
66- fw = { typography . fontWeight . normal }
41+ fw = { typography . fontWeight . medium }
6742 size = "sm"
68- onClick = { ( ) => onNavClick ( link . path ) }
43+ mb = { spacing . xs }
6944 style = { { fontFamily : typography . fontFamily . primary } }
7045 >
71- { link . label }
72- </ Anchor >
73- ) ) }
74- </ Stack >
75- </ Box >
76-
77- < Divider color = { colors . border . dark } />
78-
79- { /* Navigation Links Section */ }
80- < Box >
81- { navLinks . map ( ( link ) => (
46+ { item . label }
47+ </ Text >
48+ < Stack gap = { spacing . xs } pl = { spacing . md } >
49+ { item . dropdownItems . map ( ( dropdownItem ) => (
50+ < Anchor
51+ key = { dropdownItem . label }
52+ c = { colors . text . inverse }
53+ variant = "subtle"
54+ td = "none"
55+ fw = { typography . fontWeight . normal }
56+ size = "sm"
57+ onClick = { dropdownItem . onClick }
58+ style = { { fontFamily : typography . fontFamily . primary } }
59+ >
60+ { dropdownItem . label }
61+ </ Anchor >
62+ ) ) }
63+ </ Stack >
64+ </ Box >
65+ ) : (
66+ // Render regular link
8267 < Anchor
83- key = { link . label }
68+ key = { item . label }
8469 c = { colors . text . inverse }
8570 variant = "subtle"
8671 td = "none"
8772 fw = { typography . fontWeight . medium }
8873 size = "sm"
89- onClick = { ( ) => onNavClick ( link . path ) }
74+ onClick = { item . onClick }
9075 style = { { fontFamily : typography . fontFamily . primary } }
9176 display = "block"
92- mb = { spacing . xs }
9377 >
94- { link . label }
78+ { item . label }
9579 </ Anchor >
96- ) ) }
97- </ Box >
80+ )
81+ ) }
9882 </ Stack >
9983 </ Drawer >
10084 </ >
0 commit comments