spotube/website/src/lib/components/navbar/darkmode-toggle.svelte
Kingkor Roy Tirtho cd669e22c1
website: new sveltekit based website (#1239)
* feat: initialize website project

* feat: add initial homepage with download links

* feat: initial download page

* fix: linux icon color

* feat: add mobile nav and github star button

* feat: add older and nightly downloads page

* feat: add supporters and footer

* feat: add author details in about page

* feat: add darkmode toggle for website

* feat: add playstore and flathub download buttons and contribution button

* feat: add blogs support

* feat: remove netlify deploy config and add cloudflare config and favicons + manifest

* chore: add robots.txt

* feat: add spotube logo in navbar and fix build errors

* chore: add gap
2024-02-17 13:48:27 +06:00

33 lines
692 B
Svelte

<script lang="ts">
import { SlideToggle } from '@skeletonlabs/skeleton';
import { persisted } from '$lib/persisted-store';
import { browser } from '$app/environment';
export const isDark = persisted('dark-mode', false);
$: {
if (browser) {
$isDark
? document.documentElement.classList.add('dark')
: document.documentElement.classList.remove('dark');
}
}
export let label: string | undefined;
</script>
<div class="inline-flex gap-2">
{#if label}
<label class="ps-4">{label}</label>
{/if}
<SlideToggle
active="bg-primary-backdrop-token"
size="sm"
name="dark-mode"
checked={$isDark}
on:change={() => {
isDark.update((prev) => !prev);
}}
/>
</div>