'use client'; import React, { useEffect, useState } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import { usePathname } from 'next/navigation'; const NAV_LINKS = [ { label: 'Home', href: '/' }, { label: 'Robots', href: '/robots/' }, { label: 'Brands', href: '/brands/' }, { label: 'Industries', href: '/industries/' }, { label: 'About', href: '/about/' }, { label: 'Contact', href: '/contact/' }, { label: 'Book Demo', href: '/book-demo/' }, ]; export function Navbar() { const [scrolled, setScrolled] = useState(false); const [mobileOpen, setMobileOpen] = useState(false); const pathname = usePathname() || '/'; useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 16); onScroll(); window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); useEffect(() => { document.body.style.overflow = mobileOpen ? 'hidden' : ''; return () => { document.body.style.overflow = ''; }; }, [mobileOpen]); const isActive = (href: string) => { if (href === '/') return pathname === '/' || pathname === ''; return pathname.startsWith(href.replace(/\/$/, '')); }; return ( <>