From 5efb2912c0ce91680566d9713ff2d5ab0a8d6913 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Wed, 17 Apr 2024 00:15:27 +0000 Subject: [PATCH] Update theme handling and add theme selection dropdown in Navbar.svelte --- src/lib/components/AdventureCard.svelte | 8 ++++---- src/lib/components/Navbar.svelte | 3 +++ src/routes/+page.server.ts | 3 ++- src/routes/login/+page.svelte | 2 +- tailwind.config.js | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index c37c1c2..357635d 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -40,7 +40,7 @@ {#if type === "mylog"}

{name}

@@ -72,7 +72,7 @@ {#if type === "featured"}

{name}

@@ -94,7 +94,7 @@ {#if type === "shared"}

{name}

@@ -122,7 +122,7 @@ {#if type === "worldtravelregion"}

{name}

diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index e1a9802..e5ed5de 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -107,6 +107,9 @@
  • +
  • + +
  • diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 35f69e4..d63d596 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -30,7 +30,8 @@ export const actions: Actions = { }, setTheme: async ( { url, cookies }) => { const theme = url.searchParams.get("theme"); - if (theme) { + // change the theme only if it is one of the allowed themes + if (theme && ["light", "dark", "night", "retro", "forest"].includes(theme)) { cookies.set("colortheme", theme, { path: "/", maxAge: 60 * 60 * 24 * 365, diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index d3d5eed..7c723da 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -55,7 +55,7 @@
    {#if errors.message} -
    +
    {errors.message}
    {/if} diff --git a/tailwind.config.js b/tailwind.config.js index e17912a..90ec0e6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -6,6 +6,6 @@ export default { }, plugins: [require("@tailwindcss/typography"), require("daisyui")], daisyui: { - themes: ["light", "dark"], + themes: ["light", "dark", "night", "retro", "forest"], }, };