// Tweaks panel for Sabrana const { useState: useStateTw, useEffect: useEffectTw } = React; function Tweaks({ tweaks, onSet }) { const [active, setActive] = useStateTw(false); const [open, setOpen] = useStateTw(true); useEffectTw(() => { function handle(e) { const d = e.data || {}; if (d.type === "__activate_edit_mode") setActive(true); if (d.type === "__deactivate_edit_mode") setActive(false); } window.addEventListener("message", handle); window.parent.postMessage({ type: "__edit_mode_available" }, "*"); return () => window.removeEventListener("message", handle); }, []); if (!active) return null; const accents = [ { id: "burgundy", label: "Burgundy", color: "#6B1F2A" }, { id: "oxblood", label: "Oxblood", color: "#58161E" }, { id: "plum", label: "Plum", color: "#5A2A43" }, { id: "claret", label: "Claret", color: "#7A2E3A" }, { id: "ink", label: "Ink (mono)", color: "#1C1A17" }, ]; const palettes = [ { id: "beige", label: "Beige (signature)" }, { id: "ivory", label: "Ivory" }, { id: "stone", label: "Stone" }, ]; const types = [ { id: "cormorant", label: "Cormorant × Inter" }, { id: "playfair", label: "Playfair × Inter" }, { id: "dmserif", label: "DM Serif × DM Sans" }, ]; const headlines = [ { id: "original", label: "Original" }, { id: "atelier", label: "Atelier" }, { id: "winery", label: "Winery" }, ]; return (
Tweaks
{open && (
{accents.map((a) => (
onSet({ palette: v })} /> onSet({ type: v })} /> onSet({ headline: v })} /> onSet({ density: v })} /> onSet({ cursor: v })} />
)}
); } function Group({ label, children }) { return (
{label}
{children}
); } function Segmented({ options, value, onChange }) { return (
{options.map((o) => ( ))}
); } window.Tweaks = Tweaks;