import { useEffect, useState } from 'react'; import { navLinks } from '../../features/landing/data/content'; import { ModeToggle } from '../ui/ModeToggle'; import { VariantToggle } from '../ui/VariantToggle'; import { handleAnchorClick } from '../../utils/scrollToHash'; import { t } from '../../i18n'; /** * Navigation of design B: part of the brand-red header, white text, the CTA as a white block * (desktop only). Below the `md` breakpoint a hamburger opens an animated overlay menu with the * section links; the "Start project" CTA is not repeated there (the hero has its own buttons). */ export function Nav() { const [isMenuOpen, setIsMenuOpen] = useState(false); const sectionLinks = navLinks.filter((link) => !link.isCta); const menuLabel = isMenuOpen ? t('site.nav.menuClose') : t('site.nav.menuOpen'); // Escape closes the mobile menu (keyboard users). useEffect(() => { if (!isMenuOpen) return; const onKey = (event: KeyboardEvent) => { if (event.key === 'Escape') setIsMenuOpen(false); }; document.addEventListener('keydown', onKey); return () => document.removeEventListener('keydown', onKey); }, [isMenuOpen]); function handleMobileLinkClick(event: React.MouseEvent, href: string) { handleAnchorClick(event, href); setIsMenuOpen(false); } return ( ); }