const NAV_LINKS = [ { id: 'book', label: 'Book' }, { id: 'how', label: 'How it works' }, { id: 'services', label: 'Services' }, { id: 'gallery', label: 'Gallery' }, { id: 'about', label: 'About' }, { id: 'faq', label: 'FAQ' }, ]; const Nav = () => { const [scrolled, setScrolled] = React.useState(false); const [open, setOpen] = React.useState(false); React.useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 40); onScroll(); window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); const go = (id) => { setOpen(false); const el = document.getElementById(id); if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' }); }; return (
{e.preventDefault(); window.scrollTo({top:0,behavior:'smooth'});}}> Prestige Auto Spa Mobile PRESTIGE Auto Spa Mobile
(310) 555-0110
{open && (
{NAV_LINKS.map(l => ( {e.preventDefault(); go(l.id);}}>{l.label} ))}
)}
); }; window.Nav = Nav;