// chrome.jsx — Shared site chrome: SiteHeader, SiteFooter, PhotoSlot,
// SectionHead, SystemNav. All site mockups compose these.
const NAV_ITEMS = [
{ id: 'home', label: 'Início', href: 'index.html' },
{ id: 'quem-somos', label: 'Quem somos', href: 'quem-somos.html' },
{ id: 'como-ajudar', label: 'Como ajudar', href: 'como-ajudar.html' },
{ id: 'transparencia', label: 'Transparência', href: 'transparencia.html' },
{ id: 'contato', label: 'Contato', href: 'contato.html' },
];
function SiteHeader({ active = 'home' }) {
var w = useWindowWidth();
var mob = w > 407 && w <= 700;
var tab = (w > 700 && w <= 1074) || w <= 407;
var [menuOpen, setMenuOpen] = React.useState(false);
React.useEffect(function() {
if (!tab && menuOpen) setMenuOpen(false);
}, [tab]);
React.useEffect(function() {
document.body.style.overflow = menuOpen ? 'hidden' : '';
document.body.classList.toggle('drawer-open', menuOpen);
return function() {
document.body.style.overflow = '';
document.body.classList.remove('drawer-open');
};
}, [menuOpen]);
React.useEffect(function() {
if (!menuOpen) return;
function onKey(e) { if (e.key === 'Escape') setMenuOpen(false); }
document.addEventListener('keydown', onKey);
return function() { document.removeEventListener('keydown', onKey); };
}, [menuOpen]);
return (
<>
{/* Desktop — full nav + CTA */}
{!mob && !tab && (
)}
{!mob && !tab && (
)}
{/* Mobile — full nav (wraps) */}
{mob && (
)}
{/* Tablet — hamburger button */}
{tab && (
)}
{/* Tablet drawer */}
{tab && menuOpen && (
<>
>
)}
>
);
}
function SiteFooter() {
return (
);
}
// ────────────────────────────────────────────────────────────────
// ImageModal — full-screen photo lightbox
// ────────────────────────────────────────────────────────────────
function ImageModal({ src, alt, onClose }) {
React.useEffect(function() {
function onKey(e) { if (e.key === 'Escape') onClose(); }
document.addEventListener('keydown', onKey);
document.body.style.overflow = 'hidden';
return function() {
document.removeEventListener('keydown', onKey);
document.body.style.overflow = '';
};
}, []);
return (
);
}
// ────────────────────────────────────────────────────────────────
// PhotoSlot — placeholder for a photo to be inserted later
// ────────────────────────────────────────────────────────────────
function PhotoSlot({ height = 360, label = 'FOTOGRAFIA', tone = 'sol', round = 0, aspect }) {
const bg = `color-mix(in oklab, var(--${tone}) 22%, var(--paper-2))`;
return (
);
}
// ────────────────────────────────────────────────────────────────
// SectionHead — kicker + title + intro
// ────────────────────────────────────────────────────────────────
function SectionHead({ kicker, title, intro, align = 'left', italic = true, color, titleSize = 56 }) {
const c = color || 'var(--ink)';
return (
{kicker && (
{kicker}
)}
{title}
{intro && (
{intro}
)}
);
}
// ────────────────────────────────────────────────────────────────
// useWindowWidth — hook para layout responsivo via inline styles
// ────────────────────────────────────────────────────────────────
function useWindowWidth() {
var [width, setWidth] = React.useState(window.innerWidth);
React.useEffect(function() {
function handle() { setWidth(window.innerWidth); }
window.addEventListener('resize', handle);
return function() { window.removeEventListener('resize', handle); };
}, []);
return width;
}
// ────────────────────────────────────────────────────────────────
// WhatsAppFab — floating action button, links to Doações number
// ────────────────────────────────────────────────────────────────
function WhatsAppFab() {
return (
);
}
// ────────────────────────────────────────────────────────────────
// PageShell — fixed-width 1080px centered (mocks a desktop page)
// ────────────────────────────────────────────────────────────────
function PageShell({ children }) {
var [modal, setModal] = React.useState(null);
React.useEffect(function() {
window.openPhotoModal = function(src, alt) { setModal({ src: src, alt: alt || '' }); };
return function() { delete window.openPhotoModal; };
}, []);
React.useEffect(function() {
var observer = new IntersectionObserver(function(entries) {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
entry.target.classList.add('revealed');
observer.unobserve(entry.target);
}
});
}, { threshold: 0.06, rootMargin: '0px 0px -32px 0px' });
document.querySelectorAll('[data-reveal]').forEach(function(el) {
observer.observe(el);
});
return function() { observer.disconnect(); };
}, []);
return (
{children}
{modal && }
);
}
Object.assign(window, {
SiteHeader, SiteFooter, PhotoSlot, SectionHead, PageShell, WhatsAppFab,
NAV_ITEMS, useWindowWidth,
});