// Shared chrome — Header, Footer, WhatsApp float, router hook
// Loaded as text/babel.
const WHATSAPP_URL = 'https://wa.me/5511999905029?text=Ol%C3%A1!%20Gostaria%20de%20um%20or%C3%A7amento.';
// Clean-URL routing (History API). Legacy #/ URLs are rewritten to paths in index.html.
function currentPath() {
return window.FaukoSEO.route();
}
function useHashRoute() {
const [route, setRoute] = React.useState(currentPath());
React.useEffect(() => {
const onNav = () => setRoute(currentPath());
window.addEventListener('popstate', onNav);
window.addEventListener('fauko:route', onNav);
return () => {
window.removeEventListener('popstate', onNav);
window.removeEventListener('fauko:route', onNav);
};
}, []);
return route;
}
function navigate(path) {
if (currentPath() !== path) {
window.history.pushState(null, '', window.FaukoSEO.href(path));
window.dispatchEvent(new Event('fauko:route'));
window.scrollTo({ top: 0, behavior: 'instant' });
}
}
function Link({ to, children, className, onClick, ...rest }) {
return (
{
// let the browser handle new-tab / new-window clicks
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return;
e.preventDefault();
navigate(to);
onClick && onClick(e);
}}
{...rest}
>
{children}
);
}
const NAV_ITEMS = [
{ to: '/', label: 'Home' },
{ to: '/produtos', label: 'Produtos' },
{ to: '/quem-somos', label: 'Quem Somos' },
];
function Header() {
const route = useHashRoute();
const [open, setOpen] = React.useState(false);
const isActive = (to) => {
if (to === '/') return route === '/' || route === '';
return route.startsWith(to);
};
return (