"use client"; import * as React from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { ArrowRight, Menu, X } from "lucide-react"; import { Logo } from "@/components/brand/logo"; import { Button } from "@/components/ui/button"; import { ThemeToggle } from "./theme-toggle"; import { cn } from "@/lib/utils"; const NAV = [ { label: "Features", href: "/#features" }, { label: "Demo", href: "/#demo" }, { label: "Models", href: "/models" }, { label: "Security", href: "/security" }, { label: "FAQ", href: "/#faq" }, ]; export function MarketingHeader() { const [open, setOpen] = React.useState(false); const pathname = usePathname(); const reduce = useReducedMotion(); // Close the mobile menu when navigating (state adjusted during render, not in an effect). const [seenPath, setSeenPath] = React.useState(pathname); if (seenPath !== pathname) { setSeenPath(pathname); setOpen(false); } React.useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") setOpen(false); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [open]); return (
{open ? ( ) : null}
); }