'use client'; import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Menu, X } from 'lucide-react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { Button } from './Button'; import { pageLinks } from '@/app/home/data/navigationData'; export const Navbar = () => { const [scrolled, setScrolled] = useState(false); const [menuOpen, setMenuOpen] = useState(false); const rawPathname = usePathname(); const pathname = rawPathname?.replace(/\/$/, '') || '/'; const scrollToContact = () => { setMenuOpen(false); const el = document.getElementById('contacto'); if (el) el.scrollIntoView({ behavior: 'smooth' }); else window.location.href = '/#contacto'; }; useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 80); window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); useEffect(() => { setMenuOpen(false); }, [pathname]); return ( <> Rynext Technologies {/* Desktop nav */} {pageLinks.filter(l => l.href !== '/privacidad').map((link) => { const active = pathname === link.href; return ( (e.currentTarget.style.color = '#0a0a0a')} onMouseLeave={(e) => (e.currentTarget.style.color = active ? '#0a0a0a' : '#6a6866')} > {link.label} ); })} Hablemos {/* Mobile menu button */} setMenuOpen((v) => !v)} className="flex items-center justify-center rounded p-2 md:hidden" style={{ color: '#0a0a0a', background: 'none', border: 'none', cursor: 'pointer' }} aria-label={menuOpen ? 'Cerrar menú' : 'Abrir menú'} aria-expanded={menuOpen} > {menuOpen ? : } {/* Mobile menu */} {menuOpen && ( {pageLinks.map((link) => ( {link.label} ))} Hablemos )} > ); };