Add Nord theme option to theme selection dropdown in Navbar.svelte
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
import { onMount } from "svelte";
|
||||
import InfoModal from "./InfoModal.svelte";
|
||||
import infoIcon from "$lib/assets/info.svg";
|
||||
import type { SubmitFunction } from "@sveltejs/kit";
|
||||
async function goHome() {
|
||||
goto("/");
|
||||
}
|
||||
@@ -27,6 +28,13 @@
|
||||
goto("/worldtravel");
|
||||
}
|
||||
|
||||
const submitUpdateTheme: SubmitFunction = ({ action }) => {
|
||||
const theme = action.searchParams.get("theme");
|
||||
if (theme) {
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
}
|
||||
};
|
||||
|
||||
let count = 0;
|
||||
|
||||
let infoModalOpen = false;
|
||||
@@ -104,10 +112,11 @@
|
||||
tabindex="0"
|
||||
class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52"
|
||||
>
|
||||
<form method="POST">
|
||||
<form method="POST" use:enhance={submitUpdateTheme}>
|
||||
<li><button formaction="/?/setTheme&theme=light">Light</button></li>
|
||||
<li><button formaction="/?/setTheme&theme=dark">Dark</button></li>
|
||||
<li><button formaction="/?/setTheme&theme=night">Night</button></li>
|
||||
<!-- <li><button formaction="/?/setTheme&theme=nord">Nord</button></li> -->
|
||||
<!-- <li><button formaction="/?/setTheme&theme=retro">Retro</button></li> -->
|
||||
<li><button formaction="/?/setTheme&theme=forest">Forest</button></li>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user