'use client'; /** * The `
` mobile menu, closing itself after a navigation. * * Links in the menu are soft navigations now (`SmartLink`), so the header is NOT * re-created on the next page: a plain `
` would stay open on top of the * page the shopper just chose. This closes it whenever the pathname changes. * It stays a native `
`, so it still works before hydration. */ import * as React from 'react'; import { usePathname } from 'next/navigation'; interface HeaderMobileMenuProps { className?: string; children: React.ReactNode; } export function HeaderMobileMenu({ className, children }: HeaderMobileMenuProps) { const ref = React.useRef(null); const pathname = usePathname(); React.useEffect(() => { ref.current?.removeAttribute('open'); }, [pathname]); return (
{children}
); }