/* Aifit — top parts: FontSizeToggle, Header, SideRail, Hero */ (function () { const { useState, useEffect } = React; const Icon = window.Icon; /* ---------- font-size accessibility ---------- */ function FontSizeToggle() { const [val, setVal] = useState("normal"); useEffect(() => { const s = localStorage.getItem("aifit-fz") || "normal"; apply(s); setVal(s); }, []); function apply(k) { const el = document.documentElement; if (k === "normal") el.removeAttribute("data-fz"); else el.setAttribute("data-fz", k); localStorage.setItem("aifit-fz", k); } const opts = [["normal", "標準"], ["large", "大"], ["xlarge", "特大"]]; return (
文字サイズ
{opts.map(([k, lbl], i) => ( ))}
); } /* ---------- header ---------- */ function Brand({ light }) { return ( aifit 諸事情対応専門・創業{new Date().getFullYear() - 1947}年 ); } function Header({ contact, nav }) { const [scrolled, setScrolled] = useState(false); const [hidden, setHidden] = useState(false); const [open, setOpen] = useState(false); useEffect(() => { const on = () => setScrolled(window.scrollY > 20); on(); window.addEventListener("scroll", on, { passive: true }); return () => window.removeEventListener("scroll", on); }, []); // mobile: peek out on the way up, tuck away while scrolling down / at rest useEffect(() => { let lastY = window.scrollY, idle; const onScroll = () => { const y = window.scrollY; clearTimeout(idle); if (y < 60) setHidden(false); else if (y > lastY + 3) setHidden(true); else if (y < lastY - 3) setHidden(false); lastY = y; idle = setTimeout(() => { if (window.scrollY > 60) setHidden(true); }, 500); }; window.addEventListener("scroll", onScroll, { passive: true }); return () => { window.removeEventListener("scroll", onScroll); clearTimeout(idle); }; }, []); useEffect(() => { document.body.style.overflow = open ? "hidden" : ""; }, [open]); return (
{contact.tel} {contact.hours}
{/* drawer */}
setOpen(false)}>
Aifitチャットに相談する {contact.tel}{contact.hours}
); } /* ---------- right action rail ---------- */ function SideRail({ contact }) { const items = [ { icon: "doc", label: "資料請求", href: "https://saiki-sousai.com/document/" }, ]; return ( ); } /* ---------- hero ---------- */ function Hero({ platform, selected, onSelect, contact }) { const Platform = window.Platform; return (
創業{new Date().getFullYear() - 1947}年

創業者が東広島市社会福祉協議会会長を務めた、
諸事情対応専門の葬儀社

); } Object.assign(window, { FontSizeToggle, Header, SideRail, Hero }); })();