1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 15:25:33 -04:00

bump next to 13.5

This commit is contained in:
2023-10-02 11:59:15 -04:00
parent 1d8c2eab99
commit 893db7e951
24 changed files with 707 additions and 2528 deletions

View File

@@ -17,9 +17,9 @@ const ThemeScript = memo<ThemeScriptProps>(({ themeClassNames, themeStorageKey }
// since the client function will end up being injected as a static hard-coded string, we need to determine all of
// the dynamic values within it *before* generating the final script.
const source = String(clientScript)
.replace("__MEDIA_QUERY__", "(prefers-color-scheme: dark)")
.replace("__STORAGE_KEY__", themeStorageKey)
.replace("__CLASS_NAMES__", Object.values(themeClassNames).join('","'));
.replaceAll("__MEDIA_QUERY__", "(prefers-color-scheme: dark)")
.replaceAll("__STORAGE_KEY__", themeStorageKey)
.replaceAll("__CLASS_NAMES__", Object.values(themeClassNames).join('","'));
// turn the raw function into an iife
const unminified = `(${source})()`;

View File

@@ -17,7 +17,7 @@ export const clientScript = () => {
const newTheme = (pref && pref === "dark") ?? window.matchMedia("__MEDIA_QUERY__").matches ? 1 : 0;
// remove both `classNames` to start fresh...
classList.remove(classNames[0], classNames[1]);
classList.remove(...classNames);
// ...and then FINALLY set the root class
classList.add(classNames[newTheme]);