84 lines
2.6 KiB
JavaScript
84 lines
2.6 KiB
JavaScript
const TWEAKS_DEFAULTS = /*EDITMODE-BEGIN*/{
|
|
"accentPreset": "ember",
|
|
"accent": "#e25822",
|
|
"accentLight": "#f3895a",
|
|
"primary": "#070707",
|
|
"headingFont": "Inter",
|
|
"monoFont": "JetBrains Mono",
|
|
"imageTreatment": "default",
|
|
"density": "comfortable",
|
|
"marquee": true,
|
|
"cursorGlow": false,
|
|
"showPartners": true,
|
|
"showStats": true,
|
|
"showServices": true,
|
|
"showCorridors": true,
|
|
"showTech": true,
|
|
"showOnSet": true,
|
|
"ctaLabel": "View Projects"
|
|
}/*EDITMODE-END*/;
|
|
|
|
function loadFont(family) {
|
|
const id = "wd-font-" + family.replace(/\s/g,"-");
|
|
if (document.getElementById(id)) return;
|
|
const l = document.createElement("link");
|
|
l.id = id; l.rel = "stylesheet";
|
|
l.href = `https://fonts.googleapis.com/css2?family=${family.replace(/\s/g,"+")}:wght@300;400;500;600;700&display=swap`;
|
|
document.head.appendChild(l);
|
|
}
|
|
|
|
function App() {
|
|
const [tweaks] = useTweaks(TWEAKS_DEFAULTS);
|
|
const [openSlug, setOpenSlug] = React.useState(() => {
|
|
const m = location.hash.match(/#\/projects\/([\w-]+)/);
|
|
return m ? m[1] : null;
|
|
});
|
|
|
|
React.useEffect(() => {
|
|
if (openSlug) location.hash = `#/projects/${openSlug}`;
|
|
else if (location.hash.startsWith("#/projects/")) location.hash = "";
|
|
}, [openSlug]);
|
|
|
|
React.useEffect(() => {
|
|
loadFont(tweaks.headingFont);
|
|
loadFont(tweaks.monoFont);
|
|
const r = document.documentElement.style;
|
|
r.setProperty("--color-accent", tweaks.accent);
|
|
r.setProperty("--color-accent-light", tweaks.accentLight);
|
|
r.setProperty("--color-primary", tweaks.primary);
|
|
r.setProperty("--font-inter", `"${tweaks.headingFont}"`);
|
|
r.setProperty("--font-mono-stack", `"${tweaks.monoFont}"`);
|
|
}, [tweaks]);
|
|
|
|
// Image treatment via class on body
|
|
React.useEffect(() => {
|
|
document.body.dataset.imgTreat = tweaks.imageTreatment;
|
|
document.body.dataset.density = tweaks.density;
|
|
}, [tweaks.imageTreatment, tweaks.density]);
|
|
|
|
return (
|
|
<React.Fragment>
|
|
<Curtain/>
|
|
{tweaks.cursorGlow && <CursorDot/>}
|
|
<Navigation/>
|
|
<Hero ctaLabel={tweaks.ctaLabel}/>
|
|
<Clients marquee={tweaks.marquee}/>
|
|
{tweaks.showPartners && <Partners/>}
|
|
<About/>
|
|
{tweaks.showStats && <Stats/>}
|
|
{tweaks.showServices && <Services/>}
|
|
{tweaks.showCorridors !== false && <RegionalCorridors/>}
|
|
<Projects onOpen={setOpenSlug}/>
|
|
{tweaks.showTech && <TechStack/>}
|
|
{tweaks.showOnSet && <OnSet/>}
|
|
<Contact/>
|
|
<Footer/>
|
|
|
|
{openSlug && <ProjectOverlay slug={openSlug} onClose={()=>setOpenSlug(null)} onOpen={setOpenSlug}/>}
|
|
|
|
</React.Fragment>
|
|
);
|
|
}
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
|
root.render(<App/>);
|