'use client'; import React, { useState, useEffect } from 'react'; import Link from 'next/link'; export function Navbar() { const [scrolled, setScrolled] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); useEffect(() => { const handleScroll = () => { setScrolled(window.scrollY > 20); }; window.addEventListener('scroll', handleScroll, { passive: true }); return () => window.removeEventListener('scroll', handleScroll); }, []); const navLinks = [ { label: 'Contact', href: '#contact' } ]; const handleNavClick = (e: React.MouseEvent, link: any) => { if (link.progress !== undefined) { e.preventDefault(); setMobileMenuOpen(false); // We have 7 snap-sections of 100vh each. Max scroll inside the scene is 600vh. const targetScroll = link.progress * (6 * window.innerHeight); window.scrollTo({ top: targetScroll, behavior: 'smooth' }); } }; return ( <> {/* Mobile Menu Dropdown */}
{navLinks.map((link) => ( handleNavClick(e, link)} style={{ color: '#1a1a2e', fontSize: '1.4rem', fontWeight: 300, textDecoration: 'none', textTransform: 'uppercase', letterSpacing: '0.1em', borderBottom: '1px solid #f1f5f9', paddingBottom: '1rem', }} > {link.label} ))} setMobileMenuOpen(false)} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '1.25rem', borderRadius: '3rem', background: 'var(--color-gold)', color: '#ffffff', fontSize: '1.1rem', fontWeight: 600, textDecoration: 'none', textTransform: 'uppercase', letterSpacing: '0.1em', marginTop: '1rem', boxShadow: '0 4px 14px rgba(196, 162, 101, 0.3)', }} > Configure Your G1
); }