/* global React, Icon, Button, Badge, IconCircle */
const { useState: useStateSC, useEffect: useEffectSC, useRef: useRefSC } = React;
/* =============================================================
Header — fixed top bar shared by every page
============================================================= */
function Header({ active = "home" }) {
const [scrolled, setScrolled] = useStateSC(false);
const [open, setOpen] = useStateSC(false);
useEffectSC(() => {
const onScroll = () => setScrolled(window.scrollY > 12);
onScroll();
window.addEventListener("scroll", onScroll, { passive: true });
return () => window.removeEventListener("scroll", onScroll);
}, []);
// Clean, absolute URLs that mirror the live maxxisaude.com link structure.
const items = [
{ id: "especialidades", href: "/especialidades/", label: "Especialidades" },
{ id: "exames", href: "/exames/", label: "Exames" },
{ id: "tecnologia", href: "/tomografia-128-canais/", label: "Tecnologia" },
{ id: "convenios", href: "/convenios/", label: "Convênios" },
{ id: "resultados", href: "/resultados/", label: "Resultados online" },
{ id: "contato", href: "/contato/", label: "Contato" },
];
return (
(93) 99180-1155
{/* Mobile menu */}
{open && (
)}
);
}
/* =============================================================
Footer — site-wide
============================================================= */
function Footer() {
return (
);
}
function FooterLinks({ items }) {
return (
);
}
function socialIconStyle(bg) {
return {
width: 38, height: 38, borderRadius: "50%",
background: bg || "rgba(255,255,255,0.08)",
color: "#fff",
display: "inline-flex", alignItems: "center", justifyContent: "center",
textDecoration: "none",
transition: "background var(--dur-fast)",
};
}
/* =============================================================
Floating WhatsApp bubble — bottom-right
Click expands a quick chooser of specialty numbers.
============================================================= */
function WhatsAppBubble() {
const [open, setOpen] = useStateSC(false);
const popRef = useRefSC(null);
useEffectSC(() => {
if (!open) return;
const onDown = (e) => { if (popRef.current && !popRef.current.contains(e.target)) setOpen(false); };
document.addEventListener("mousedown", onDown);
return () => document.removeEventListener("mousedown", onDown);
}, [open]);
// Three official Maxxi Saúde WhatsApp channels — same shown on /contato/.
const quick = [
{
label: "Recepção",
hint: "Agendar, tirar dúvidas com a equipe e pedir ligação",
whats: RECEPCAO_WHATS,
icon: "stethoscope",
msg: "Olá! Vim pelo site da Maxxi Saúde.",
},
{
label: "Atendimento por IA",
hint: "Dúvidas gerais 24h, respostas na hora — só mensagens",
whats: IA_WHATS,
icon: "sparkle",
msg: "Olá! Tenho uma dúvida sobre a Maxxi Saúde.",
},
{
label: "Plantão 24h",
hint: "Urgência de tomografia e raio-x — só emergências",
whats: PLANTAO_WHATS,
icon: "heart-pulse",
msg: "Olá! Preciso do plantão da Maxxi Saúde.",
},
];
return (
<>
{/* Popover */}
{open && (
Maxxi Saúde
Estamos esperando por você 👋
Escolha o canal certo. Para falar por voz, use o telefone fixo ou a Recepção.
)}
{/* Bubble */}
>
);
}
/* =============================================================
Page shell — Header + main + Footer + WhatsApp bubble
Also handles reveal-on-scroll for .reveal elements.
============================================================= */
function PageShell({ active, children }) {
useEffectSC(() => {
const io = new IntersectionObserver((entries) => {
for (const e of entries) {
if (e.isIntersecting) {
e.target.classList.add("in");
io.unobserve(e.target);
}
}
}, { threshold: 0.08 });
document.querySelectorAll(".reveal").forEach(el => io.observe(el));
return () => io.disconnect();
}, []);
// Set top padding so content clears the fixed header
return (
<>
{children}
>
);
}
Object.assign(window, { Header, Footer, WhatsAppBubble, PageShell });