/* global React, window, BOXES */
// =======================================================================
// Componentes compartilhados — placeholders, selo, chips, countdown,
// nav e moldura. Os blocos maiores ficam em sections.jsx.
// =======================================================================
const { useState, useEffect, useMemo, useRef } = React;
/* ---------- placeholder de imagem ---------- */
function PH({ label = "imagem", className = "", style }) {
return (
{label}
);
}
/* ---------- selo circular giratório ---------- */
function Seal() {
return (
);
}
/* ---------- countdown ---------- */
function useCountdown(target) {
const [now, setNow] = useState(Date.now());
useEffect(() => {
const id = setInterval(() => setNow(Date.now()), 1000);
return () => clearInterval(id);
}, []);
const diff = Math.max(0, target - now);
const d = Math.floor(diff / 86400000);
const h = Math.floor(diff / 3600000) % 24;
const m = Math.floor(diff / 60000) % 60;
const s = Math.floor(diff / 1000) % 60;
return { d, h, m, s };
}
function Countdown() {
// alvo: 12 jun 2026 às 08:00 (data fixa para a campanha)
const target = useMemo(() => new Date("2026-06-12T08:00:00-03:00").getTime(), []);
const { d, h, m, s } = useCountdown(target);
const pad = (n) => String(n).padStart(2, "0");
return (
{pad(d)}
Dias
{pad(h)}
Horas
{pad(m)}
Minutos
{pad(s)}
Segundos
);
}
/* ---------- nav ---------- */
function Nav({ cartCount, onCartOpen, headline }) {
return (
);
}
/* ---------- price ---------- */
function fmt(n) {
return n.toLocaleString("pt-BR", { minimumFractionDigits: 0 });
}
function Price({ value, suffix, large }) {
return (
R$ {fmt(value)}
{suffix && {suffix}}
);
}
/* ---------- formato ms para texto ---------- */
function Toast({ msg, on }) {
return (
{msg}
);
}
/* ---------- marquee ---------- */
function Marquee() {
const phrase = "Junho sem pressa · Cafoço em casa · Encomendas até 09 de junho · Retirada de 10 a 14 de junho · Jantar no dia 12 às 20h · ";
return (