/* global React */ const { useState, useEffect, useRef } = React; /* ===================================================== Digital Valor — UI primitives + Header + Footer ===================================================== */ /* ---------- Brand contact (single source of truth) ---------- */ const DV_CONTACT = { whatsappPhone: "+55 11 93390-4582", whatsappPhoneRaw: "5511933904582", whatsappUrl: "https://api.whatsapp.com/send/?phone=5511933904582&text=Ol%C3%A1%2C+estou+vindo+pelo+site+e+gostaria+de+mais+informa%C3%A7%C3%B5es+sobre+a+Digital+Valor&type=phone_number&app_absent=0", email: "comercial@digitalvalor.com.br", emailHref: "mailto:comercial@digitalvalor.com.br", cnpj: "44.039.062/0001-82", instagram: "https://www.instagram.com/digital_valor/", siteUrl: "https://digitalvalor.com.br/", }; /* Open WhatsApp in a new tab — used by every primary CTA */ function openWhatsApp() { window.open(DV_CONTACT.whatsappUrl, "_blank", "noopener,noreferrer"); } /* ---------- Logo ---------- */ /* The horizontal logo has aspect ~1.65 (1123×682). Size it by HEIGHT; width comes from the file. Passing `size` keeps backwards-compat. */ function DVLogo({ size = 40, height, href = "Home.html", variant = "horizontal" }) { const h = height || size; const src = variant === "symbol" ? "assets/logo-digital-valor-symbol.png" : "assets/logo-digital-valor-horizontal.png"; return ( Digital Valor ); } /* ---------- Chip ---------- */ function Chip({ children }) { return ( {children} ); } /* ---------- Eyebrow ---------- */ function Eyebrow({ children, purple = false }) { return
{children}
; } /* ---------- Button ---------- - href starting with http(s) → opens in new tab with rel=noopener - onClick still supported - aria-label supported */ function Button({ children, variant = "primary", arrow = true, onClick, href, className = "", style, ariaLabel, type }) { const cls = `btn btn-${variant} ${className}`.trim(); const inner = ( {children} {arrow && } ); if (href) { const external = /^https?:\/\//i.test(href) || href.startsWith("mailto:") || href.startsWith("tel:"); return ( {inner} ); } return ; } /* ---------- CTA "Solicitar Diagnóstico" (always WhatsApp) ---------- */ function CTAButton({ children = "Solicitar Diagnóstico", variant = "primary", className = "", ariaLabel = "Solicitar diagnóstico no WhatsApp" }) { return ( ); } const NAV_LINKS = [ { label: "Início", href: "Home.html", key: "home" }, { label: "Método EDVA", href: "metodo-edva.html", key: "metodo" }, { label: "Soluções", href: "solucoes.html", key: "solucoes" }, { label: "Segmentos", href: "segmentos.html", key: "segmentos" }, { label: "Sobre", href: "sobre.html", key: "sobre" }, { label: "Diagnóstico", href: "diagnostico.html", key: "diagnostico" }, ]; function Header({ active = "home" }) { const [scrolled, setScrolled] = useState(false); const [menuOpen, setMenuOpen] = useState(false); useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 24); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); return (
Solicitar Diagnóstico
{menuOpen && (
{NAV_LINKS.map(l => ( setMenuOpen(false)}>{l.label} ))} Solicitar Diagnóstico
)}
); } /* ---------- Footer ---------- */ function Footer() { return ( ); } Object.assign(window, { DVLogo, Chip, Eyebrow, Button, CTAButton, Header, Footer, NAV_LINKS, DV_CONTACT, openWhatsApp, });