/* global React */
// ============================================================
// Craque Cidadão — site chrome: Header, Footer, FloatingWhatsApp
// ============================================================
const { Icon, CC_LOGO, WA_LINK, IG_LINK } = window;
const NAV_LINKS = [
{ id: 'home', label: 'Home' },
{ id: 'quem-somos', label: 'Quem Somos' },
{ id: 'projetos', label: 'Projetos' },
{ id: 'parceiros', label: 'Parceiros' },
{ id: 'transparencia', label: 'Transparência' },
{ id: 'galeria', label: 'Galeria' },
{ id: 'contato', label: 'Contato' },
];
function Logo({ onNav, dark = false }) {
return (
onNav('home')} aria-label="Craque Cidadão — início"
style={{ display: 'flex', alignItems: 'center', cursor: 'pointer', textDecoration: 'none' }}>
);
}
function Header({ route, onNav }) {
const { Button } = window.CraqueCidadODesignSystem_6fdc08;
const [open, setOpen] = React.useState(false);
const [scrolled, setScrolled] = React.useState(false);
React.useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > 8);
onScroll();
window.addEventListener('scroll', onScroll, { passive: true });
return () => window.removeEventListener('scroll', onScroll);
}, []);
React.useEffect(() => { setOpen(false); }, [route]);
React.useEffect(() => {
const onKey = (e) => { if (e.key === 'Escape') setOpen(false); };
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, []);
const go = (id) => { setOpen(false); onNav(id); };
return (
{/* desktop nav */}
{/* mobile toggle */}
{/* mobile drawer */}
{NAV_LINKS.map((l, i) => (
{ e.preventDefault(); go(l.id); }} style={{
'--i': i, padding: '13px 14px', cursor: 'pointer', borderRadius: 12,
fontFamily: 'var(--font-display)', fontWeight: 700, fontSize: 16,
color: route === l.id ? 'var(--brand)' : 'var(--text-strong)',
background: route === l.id ? 'var(--brand-soft)' : 'transparent', textDecoration: 'none',
}}>{l.label}
))}
Fale pelo WhatsApp
);
}
function ScrollProgress() {
const ref = React.useRef(null);
React.useEffect(() => {
let raf;
const update = () => {
const h = document.documentElement.scrollHeight - window.innerHeight;
if (ref.current) ref.current.style.transform = `scaleX(${h > 0 ? Math.min(1, window.scrollY / h) : 0})`;
};
const onScroll = () => { cancelAnimationFrame(raf); raf = requestAnimationFrame(update); };
update();
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('resize', onScroll);
return () => { window.removeEventListener('scroll', onScroll); window.removeEventListener('resize', onScroll); cancelAnimationFrame(raf); };
}, []);
return
;
}
function FloatingWhatsApp() {
const [hover, setHover] = React.useState(false);
return (
setHover(true)} onMouseLeave={() => setHover(false)}
style={{
position: 'fixed', right: 22, bottom: 22, zIndex: 80,
display: 'flex', alignItems: 'center', gap: 10,
background: 'linear-gradient(135deg, #2BD96E 0%, #1EBE5B 100%)', color: '#fff', textDecoration: 'none',
padding: '14px 19px 14px 16px', borderRadius: 'var(--radius-pill)',
fontFamily: 'var(--font-display)', fontWeight: 700, fontSize: 15,
boxShadow: hover ? '0 16px 34px rgba(30,190,91,0.5)' : '0 10px 26px rgba(30,190,91,0.4)',
transform: hover ? 'translateY(-2px)' : 'none',
transition: 'transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out)',
}}>
Fale conosco
);
}
function Footer({ onNav }) {
const { Button } = window.CraqueCidadODesignSystem_6fdc08;
const year = new Date().getFullYear();
const social = [
{ icon: 'instagram', href: IG_LINK }, { icon: 'message-circle', href: WA_LINK },
{ icon: 'mail', href: 'mailto:ongcraquecidadao@gmail.com' },
];
return (
<>
{/* contact CTA band */}
Ficou alguma dúvida?
Fale com a gente agora mesmo pelo WhatsApp.
Fale pelo WhatsApp
>
);
}
Object.assign(window, { Header, Footer, FloatingWhatsApp, Logo, NAV_LINKS });