// App: monta cada componente en su iframe-frame y enlaza Tweaks
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"primaryGreen": "#7CAB3E",
"primaryRed": "#C8253E",
"baseFontSize": 16,
"container": "medium"
}/*EDITMODE-END*/;
function applyTweaks(t) {
const root = document.documentElement;
if (t.primaryGreen) {
root.style.setProperty('--c-green', t.primaryGreen);
// derive deep from primary
root.style.setProperty('--c-green-deep', t.primaryGreen);
}
if (t.primaryRed) {
root.style.setProperty('--c-red', t.primaryRed);
root.style.setProperty('--c-red-deep', t.primaryRed);
}
if (t.baseFontSize) {
root.style.setProperty('--base-fs', t.baseFontSize + 'px');
}
if (t.container) {
document.body.dataset.container = t.container;
}
}
function TweaksApp() {
const [tweaks, setTweak] = window.useTweaks(TWEAK_DEFAULTS);
React.useEffect(() => { applyTweaks(tweaks); }, [tweaks]);
return (
setTweak('primaryGreen', v)}
/>
setTweak('primaryRed', v)}
/>
setTweak('baseFontSize', v)}
/>
setTweak('container', v)}
/>
);
}
// Mount each component
const mounts = [
['mount-nav', window.CNav],
['mount-hero', window.CHero],
['mount-about', window.CAbout],
['mount-director', window.CDirector],
['mount-lines', window.CLines],
['mount-formacion', window.CFormacion],
['mount-palabra', window.CPalabra],
['mount-ciencia', window.CCiencia],
['mount-do-seals', window.CDOSeals],
['mount-do', window.CDO],
['mount-quick', window.CQuick],
['mount-news', window.CNews],
['mount-videos', window.CVideos],
['mount-membresias',window.CMembresias],
['mount-cta', window.CCta],
['mount-normativa', window.CNormativa],
['mount-footer', window.CFooter],
['mount-whatsapp', window.CWhatsapp],
['mount-agent', window.CAgent],
];
mounts.forEach(([id, Comp]) => {
const el = document.getElementById(id);
if (el && Comp) {
ReactDOM.createRoot(el).render();
}
});
// Tweaks panel mount
const tweaksEl = document.getElementById('tweaks-mount');
if (tweaksEl) {
ReactDOM.createRoot(tweaksEl).render();
}