From d61a572f08321419ac3273d0d0e0191ff2b193e9 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 18 Dec 2023 11:41:36 +0100 Subject: fix(pages): add default settings to html tag When building the website, some styles are missing if JS is disabled in the browser because we rely on Javascript to set the current theme. By providing some default settings, the JS-free version can access those styles. --- src/pages/_document.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/pages/_document.tsx') diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 6d065cd..36e0798 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -10,8 +10,14 @@ const validPrismThemesStr = VALID_THEMES.map((t) => `"${t}"`); // eslint-disable-next-line @typescript-eslint/no-shadow -- Required by NextJs export default function Document() { + const defaultAttributes = { + [`data-${STORAGE_KEY.MOTION}`]: 'false', + [`data-${STORAGE_KEY.THEME}`]: 'light', + [PRISM_THEME_ATTRIBUTE]: 'light', + }; + return ( - +