// FOLGORE — Shared Nav + Footer + reveal helpers const { useEffect, useState } = React; function useReveal(){ useEffect(() => { const els = document.querySelectorAll('[data-reveal]'); if (!els.length) return; const io = new IntersectionObserver((entries) => { entries.forEach((e) => { if (e.isIntersecting){ e.target.classList.add('is-in'); io.unobserve(e.target); } }); }, { threshold: 0.15, rootMargin: '0px 0px -10% 0px' }); els.forEach((el) => io.observe(el)); return () => io.disconnect(); }, []); } window.useReveal = useReveal; function Nav({ active = 'home', onNavigate }){ const [open, setOpen] = useState(false); const handle = (e, page) => { e.preventDefault(); setOpen(false); if (onNavigate) onNavigate(page); }; // Lock body scroll when menu open useEffect(() => { document.body.style.overflow = open ? 'hidden' : ''; return () => { document.body.style.overflow = ''; }; }, [open]); // Close on ESC useEffect(() => { if (!open) return; const onKey = (e) => { if (e.key === 'Escape') setOpen(false); }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, [open]); const items = [ { id: 'home', label: 'Inicio', n: '01' }, { id: 'historia', label: 'Historia', n: '02' }, { id: 'catalogo', label: 'Catálogo', n: '03' }, { id: 'innovacion', label: 'Innovación', n: '04' }, { id: 'contacto', label: 'Contacto', n: '05' }, ]; return ( handle(e, 'home')} data-magnetic> {items.map(it => ( handle(e, it.id)}>{it.label} ))} IT · MX EST. 1985 setOpen(o => !o)} aria-label={open ? 'Cerrar menú' : 'Abrir menú'} aria-expanded={open} > {open ? 'CERRAR' : 'MENU'} {items.map((it, i) => ( handle(e, it.id)}> {it.n} {it.label} → ))} IT · MX EST. 1985 ); } function Footer({ onNavigate }){ const go = (e, p) => { e.preventDefault(); onNavigate && onNavigate(p); }; return ( ); } window.Nav = Nav; window.Footer = Footer;