// Home page function PixelStack() { const p = [ ".rrrrrr..", ".r....r..", ".r.cc.r..", ".r.cc.r..", ".r....r..", ".rrrrrr..", "...dd....", ".dddddd..", ].map(s => s.slice(0, 8)); const cells = []; for (let y = 0; y < 8; y++) { for (let x = 0; x < 8; x++) { const ch = p[y] && p[y][x]; let cls = ""; if (ch === "r") cls = "on"; else if (ch === "c") cls = "cream"; else if (ch === "d") cls = "dim"; cells.push(cls); } } return ( ); } function useTypewriter(fullText, speed = 55, startDelay = 300) { const [shown, setShown] = React.useState(0); React.useEffect(() => { setShown(0); let t; const start = setTimeout(() => { const tick = () => { setShown((s) => { if (s >= fullText.length) return s; t = setTimeout(tick, speed); return s + 1; }); }; tick(); }, startDelay); return () => { clearTimeout(start); clearTimeout(t); }; }, [fullText, speed, startDelay]); return shown; } function TypedHeadline() { const segments = [["Tecnologia que ", false], ["resolve", true], [" o problema — não só contorna.", false]]; const full = segments.map((s) => s[0]).join(""); const shown = useTypewriter(full, 55, 350); const done = shown >= full.length; let remaining = shown; const out = []; for (let i = 0; i < segments.length; i++) { const [txt, isAccent] = segments[i]; const take = Math.min(txt.length, remaining); remaining -= take; const piece = txt.slice(0, take); if (isAccent) { out.push({piece}); } else { out.push({piece}); } if (remaining <= 0) break; } return ( <> {out}