/* global React, Compass, Arrow, GM_ROUTES */ const { useEffect: nUseEffect, useState: nUseState } = React; const NAV_ROUTES = (window.GM_CONFIG && window.GM_CONFIG.routes) || GM_ROUTES || { home: '/', services: '/servicios/', cases: '/casos/', about: '/nosotros/', blog: '/blog-gm/', contact: '/contacto/', }; function navHref(key) { return NAV_ROUTES[key] || '/'; } function navClick(e, key, setRoute) { if (e.ctrlKey || e.metaKey || e.shiftKey) return; // permite abrir en nueva pestaña e.preventDefault(); setRoute(key); } function Nav({ route, setRoute }) { const [scrolled, setScrolled] = nUseState(false); const [theme, setTheme] = nUseState(() => document.documentElement.getAttribute('data-theme') || 'light'); nUseEffect(() => { const onScroll = () => setScrolled(window.scrollY > 20); window.addEventListener('scroll', onScroll, { passive: true }); onScroll(); const mo = new MutationObserver(() => { setTheme(document.documentElement.getAttribute('data-theme') || 'light'); }); mo.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] }); return () => { window.removeEventListener('scroll', onScroll); mo.disconnect(); }; }, []); const links = [ ['home', 'Inicio'], ['services', 'Servicios'], ['cases', 'Casos'], ['about', 'Nosotros'], ['blog', 'Blog'], ]; const logoSrc = (window.GM_CONFIG ? window.GM_CONFIG.assetsUrl + '/img/' : 'assets/') + (theme === 'dark' ? 'logo-blanco.png' : 'logo-color.png'); return ( navClick(e, 'home', setRoute)} aria-label="Growth Masters" > {links.map(([k, label]) => ( navClick(e, k, setRoute)} > {label} ))} navClick(e, 'contact', setRoute)} style={{ marginLeft: 8 }} > Hablemos ); } function Footer({ setRoute }) { const logoSrc = (window.GM_CONFIG ? window.GM_CONFIG.assetsUrl + '/img/' : 'assets/') + 'logo-blanco.png'; const navLinks = [ ['home', 'Inicio'], ['services', 'Servicios'], ['cases', 'Casos de éxito'], ['about', 'Nosotros'], ['blog', 'Blog'], ['contact', 'Contacto'], ]; return ( ); } const { useState: mnUseState, useEffect: mnUseEffect } = React; function MobileNav({ route, setRoute }) { const [visible, setVisible] = mnUseState(window.innerWidth <= 880); mnUseEffect(() => { const mq = window.matchMedia('(max-width: 880px)'); const handler = (e) => setVisible(e.matches); mq.addEventListener ? mq.addEventListener('change', handler) : mq.addListener(handler); setVisible(mq.matches); return () => mq.removeEventListener ? mq.removeEventListener('change', handler) : mq.removeListener(handler); }, []); if (!visible) return null; const accent = getComputedStyle(document.documentElement).getPropertyValue('--accent').trim() || '#EC4E3C'; const surface = getComputedStyle(document.documentElement).getPropertyValue('--surface').trim() || '#FAFAF8'; const inkLow = getComputedStyle(document.documentElement).getPropertyValue('--ink-low').trim() || '#9A9590'; const navStyle = { position: 'fixed', bottom: 0, left: 0, right: 0, zIndex: 99999, display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', background: surface, borderTop: '1px solid rgba(0,0,0,0.1)', paddingTop: '6px', paddingBottom: 'calc(8px + env(safe-area-inset-bottom, 0px))', paddingLeft: '4px', paddingRight: '4px', gap: '2px', boxShadow: '0 -4px 24px rgba(0,0,0,0.08)', }; const itemBase = { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: '3px', padding: '8px 4px 6px', borderRadius: '12px', color: inkLow, fontFamily: 'var(--font-mono, monospace)', fontSize: '9px', letterSpacing: '0.06em', textTransform: 'uppercase', textDecoration: 'none', cursor: 'pointer', WebkitTapHighlightColor: 'transparent', transition: 'color .15s', border: 'none', background: 'none', }; const items = [ ['home', 'Inicio', ( )], ['services', 'Servicios', ( )], ['cases', 'Casos', ( )], ['about', 'Nosotros', ( )], ['contact', 'Contacto', ( )], ]; return ( {items.map(([key, label, icon]) => { const isActive = route === key; return ( navClick(e, key, setRoute)} aria-label={label} > {icon} {label} ); })} ); } Object.assign(window, { Nav, Footer, MobileNav });