Skip to content

Commit be21b90

Browse files
fix: update mobile menu z-index and add dedicated close button to the navigation drawer
1 parent 6e4a74e commit be21b90

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎src/components/Header.tsx‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ export default function Header({ scrollY }: HeaderProps) {
144144
setIsMobileMenuOpen(prev => !prev);
145145
};
146146

147-
const mobileMenuIconPath = isMobileMenuOpen ? "M6 18L18 6M6 6l12 12" : "M4 6h16M4 12h16M4 18h16";
148147
const useInlineLayout = !isMobile || isSticky;
149148

150149

@@ -161,7 +160,7 @@ export default function Header({ scrollY }: HeaderProps) {
161160

162161
return (
163162
<motion.header
164-
className={`w-full sticky top-0 z-50 flex items-center justify-between border-b bg-white px-4 md:px-6 lg:px-8`}
163+
className={`w-full sticky top-0 ${isMobileMenuOpen ? 'z-[110]' : 'z-50'} flex items-center justify-between border-b bg-white px-4 md:px-6 lg:px-8`}
165164
style={{
166165
paddingTop: headerPaddingY,
167166
paddingBottom: headerPaddingY,
@@ -227,7 +226,7 @@ export default function Header({ scrollY }: HeaderProps) {
227226
aria-label="Toggle menu"
228227
>
229228
<svg className="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
230-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d={mobileMenuIconPath} />
229+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 6h16M4 12h16M4 18h16" />
231230
</svg>
232231
</button>
233232
</div>
@@ -250,6 +249,17 @@ export default function Header({ scrollY }: HeaderProps) {
250249
className="fixed top-0 right-0 bottom-0 w-full max-w-xs bg-white shadow-lg"
251250
onClick={(e) => e.stopPropagation()}
252251
>
252+
<div className="absolute top-5 right-5">
253+
<button
254+
onClick={toggleMobileMenu}
255+
className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500"
256+
aria-label="Close menu"
257+
>
258+
<svg className="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
259+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
260+
</svg>
261+
</button>
262+
</div>
253263
<div className="p-5 pt-20">
254264
<nav className="flex flex-col space-y-2">
255265
<Link href="/stats" className="px-4 py-2 text-lg font-medium text-gray-700 hover:bg-gray-100 rounded-md transition-colors" onClick={toggleMobileMenu}>

0 commit comments

Comments
 (0)