From 69f192cc369f723bab0e36c4fa0d853e69eb4e27 Mon Sep 17 00:00:00 2001 From: Korbs Date: Fri, 25 Oct 2024 15:20:25 -0400 Subject: [PATCH] Make sure default theme is set for the end-user --- source/src/components/global/Head.astro | 7 ++++--- source/src/layouts/Base.astro | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/src/components/global/Head.astro b/source/src/components/global/Head.astro index 70a3c94..89f5d9a 100644 --- a/source/src/components/global/Head.astro +++ b/source/src/components/global/Head.astro @@ -3,13 +3,14 @@ import { Tooltips } from 'astro-tooltips' // User Configuration -if (Astro.cookies.get("Theme").value === "Light") { +if (Astro.cookies.get("Theme") === undefined) { + Astro.cookies.set("Theme", "Dark") +} else if (Astro.cookies.get("Theme").value === "Light") { var ThemeScheme = 'light' } else if (Astro.cookies.get("Theme").value === "Dark") { var ThemeScheme = 'dark' -}else if (Astro.cookies.get("Theme").value === undefined) { - var ThemeScheme = 'dark' } +console.log(Astro.cookies.get("Theme")) --- diff --git a/source/src/layouts/Base.astro b/source/src/layouts/Base.astro index 349fbcd..2401314 100644 --- a/source/src/layouts/Base.astro +++ b/source/src/layouts/Base.astro @@ -12,7 +12,9 @@ import '@styles/index.scss' import '@styles/mobile.scss' // User Configuration -if (Astro.cookies.get("Theme").value === "Light") { +if (Astro.cookies.get("Theme") === undefined) { + Astro.cookies.set("Theme", "Dark") +} else if (Astro.cookies.get("Theme").value === "Light") { var ThemeScheme = 'light' } else if (Astro.cookies.get("Theme").value === "Dark") { var ThemeScheme = 'dark'