// ============================================================ // MONOGRAM — shared components // ============================================================ const { useState, useEffect, useRef, useMemo, useCallback } = React; // ---------- Reveal on scroll function useReveal() { useEffect(() => { const io = new IntersectionObserver((entries) => { entries.forEach((e) => { if (e.isIntersecting) e.target.classList.add("in"); }); }, { threshold: 0.12, rootMargin: "0px 0px -10% 0px" }); document.querySelectorAll(".reveal").forEach((el) => io.observe(el)); return () => io.disconnect(); }); } // ---------- Nav scrolled function useScrolled(threshold = 24) { const [scrolled, setScrolled] = useState(false); useEffect(() => { const onScroll = () => setScrolled(window.scrollY > threshold); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, [threshold]); return scrolled; } // ---------- Monogram wordmark function Wordmark({ size = "default" }) { const small = size === "small"; return (
MONOGRAM Escaping Flatland
); } // ---------- Nav function Nav({ route, setRoute, locale, setLocale }) { const scrolled = useScrolled(); const t = COPY[locale]; return (
setRoute({ name: "home" })}>
); } function scrollToId(id) { const target = document.getElementById(id); if (target) { const y = target.getBoundingClientRect().top + window.scrollY - 80; window.scrollTo({ top: y, behavior: "smooth" }); } } // ---------- Section head function SectionHead({ num, eyebrow, title, titleItal, sub, id }) { return (
{num} · {eyebrow}

{title} {titleItal}

{sub ?

{sub}

: null}
); } // ---------- WhatsApp FAB function WhatsAppFab({ locale }) { const t = COPY[locale]; const href = "https://wa.me/971504563365?text=" + encodeURIComponent( locale === "ar" ? "مرحباً MONOGRAM، أودّ حجز استشارة خاصّة." : "Hi MONOGRAM, I'd like to book a bespoke consultation." ); return ( ); } // ---------- Footer function Footer({ setRoute, locale }) { const t = COPY[locale]; return ( ); } Object.assign(window, { useReveal, useScrolled, Wordmark, Nav, SectionHead, WhatsAppFab, Footer, scrollToId });