/* Crux LP — Tweaks island.
A small React root that only renders the Tweaks panel and applies
its values to the vanilla LP via body attribute + CSS variables. */
const CRUX_TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"hero": "split",
"accent": ["#2563eb", "#1d4ed8", "#eaf1ff"],
"displayFont": "Zen Kaku Gothic New"
}/*EDITMODE-END*/;
function CruxTweaks() {
const [t, setTweak] = useTweaks(CRUX_TWEAK_DEFAULTS);
React.useEffect(() => {
document.body.setAttribute("data-hero", t.hero);
}, [t.hero]);
React.useEffect(() => {
const [main, dark, tint] = t.accent;
const r = document.documentElement.style;
r.setProperty("--blue", main);
r.setProperty("--blue-600", main);
r.setProperty("--blue-500", main);
r.setProperty("--blue-700", dark);
r.setProperty("--blue-tint", tint);
r.setProperty("--app-blue", main);
}, [t.accent]);
React.useEffect(() => {
document.documentElement.style.setProperty(
"--font-display",
`"${t.displayFont}", "Noto Sans JP", system-ui, sans-serif`
);
}, [t.displayFont]);
return (
setTweak("hero", v)}
/>
setTweak("accent", v)}
/>
setTweak("displayFont", v)}
/>
);
}
(function mountTweaks() {
const el = document.getElementById("tweaks-root");
if (el) ReactDOM.createRoot(el).render();
})();