'use client'; import { useEffect, useRef, useState } from 'react'; import { RiCloseLine, RiMenuLine } from '@remixicon/react'; import { Brand } from '@/components/shared/brand'; import { Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, } from '@/components/ui/sheet'; import { siteConfig, type NavigationItem } from '@/lib/site'; export function MobileNavigation({ items }: { items: NavigationItem[] }) { const [open, setOpen] = useState(false); const navigating = useRef(false); useEffect(() => { const desktop = window.matchMedia('(min-width: 768px)'); const closeOnDesktop = () => { if (desktop.matches) setOpen(false); }; desktop.addEventListener('change', closeOnDesktop); return () => desktop.removeEventListener('change', closeOnDesktop); }, []); return ( { // Let the anchor move focus to its section without the trigger // interrupting the page's smooth scroll when the sheet closes. if (navigating.current) event.preventDefault(); navigating.current = false; }} >
Explore {siteConfig.name} Explore our products, solutions, resources, documentation, and pricing.
{ navigating.current = true; }} className="flex h-12 items-center justify-center rounded-full bg-foreground px-4 text-sm font-medium text-background transition-colors hover:bg-foreground/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/30 focus-visible:ring-offset-2 focus-visible:ring-offset-background" > Sign Up { navigating.current = true; }} className="flex h-12 items-center justify-center rounded-full border border-border px-4 text-sm font-medium text-foreground/70 transition-colors hover:bg-foreground/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/30" > Log In
); }