/* MobileNav — hamburger menu for sub-md viewports.
*
* Reuses the same nav config that the desktop NavigationMenu consumes
* (passed in via prop) so the IA stays in sync. Renders as a Sheet
* sliding in from the left, with the same active-route treatment
* (2 px brand-blue underline). */
'use client';
import { useState } from 'react';
import Link from 'next/link';
import { Menu } from 'lucide-react';
import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
SheetTrigger,
} from '@/components/ui/sheet';
import { Separator } from '@/components/ui/separator';
interface NavItem {
title: string;
href?: string;
icon?: React.ElementType;
description?: string;
children?: NavItem[];
}
interface MobileNavProps {
items: NavItem[];
pathname: string;
isActive: (href?: string) => boolean;
}
export function MobileNav({ items, pathname, isActive }: MobileNavProps) {
const [open, setOpen] = useState(false);
// Close the sheet when the path changes — handles the link click before
// useEffect from a route subscription. Effect would also work but this
// is simpler and side-effect-free.
const handleNav = () => setOpen(false);
return (
Don't be afraid to cry · Wulf Consulting
{item.icon &&