const Navbar = () => { const [scrolled, setScrolled] = React.useState(false); const [menuOpen, setMenuOpen] = React.useState(false); React.useEffect(() => { const handleScroll = () => { setScrolled(window.scrollY > 50); }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); const navLinks = [ { name: 'HOME', href: 'index.php' }, { name: 'THE EXPERIENCE', href: 'experience.php' }, { name: 'AMENITIES', href: 'amenities.php' }, { name: 'GALLERY', href: 'gallery.php' }, { name: 'BOOK NOW', href: 'book-now.php' } ]; // Simulating active path, in a real single-page app this would use a router hook. // For now we will just make "HOME" active by default or base it on pathname. const currentPath = window.location.pathname.split('/').pop() || 'index.php'; return ( {/* Desktop Floating Island Menu */} {/* Logo Top Pill (Always visible) */} Villa Nevas {/* Main Nav Pill (Expands on container hover) */} {navLinks.map((link) => { const isActive = currentPath === link.href || (currentPath === '' && link.href === 'index.php'); return ( {/* Small dot indicator above text */} {link.name} ); })} {/* Mobile Nav Button */} setMenuOpen(!menuOpen)} className={`bg-black text-white px-8 py-3 rounded-full font-serif text-xl font-bold tracking-wider shadow-lg border border-white/10 transition-all duration-300 pointer-events-auto ${menuOpen ? 'border-b-0 opacity-0 pointer-events-none' : 'opacity-100'} `} > Villa Nevas {/* Mobile Menu Overlay */} {/* Mobile Open Header */} Villa Nevas setMenuOpen(false)} className="absolute right-6 top-2 text-white/50 hover:text-white text-3xl"> {/* Mobile Links */} {navLinks.map((link) => { const isActive = currentPath === link.href || (currentPath === '' && link.href === 'index.php'); return ( {link.name} ); })} ); }; const root = ReactDOM.createRoot(document.getElementById('nav-root')); root.render();