Files
gpx.studio/website/src/lib/components/ModeSwitch.svelte

22 lines
502 B
Svelte
Raw Normal View History

2024-07-05 01:02:53 +02:00
<script lang="ts">
import { Button } from '$lib/components/ui/button';
2025-06-21 21:07:36 +02:00
import { Moon, Sun } from '@lucide/svelte';
2025-06-08 16:32:41 +02:00
import { mode, setMode } from 'mode-watcher';
2025-06-21 21:07:36 +02:00
import { i18n } from '$lib/i18n.svelte';
2024-07-05 01:02:53 +02:00
</script>
2024-07-07 18:26:52 +02:00
<Button
variant="ghost"
2025-06-21 21:07:36 +02:00
size="icon"
onclick={() => {
2025-06-08 16:32:41 +02:00
setMode(mode.current === 'light' ? 'dark' : 'light');
}}
2025-06-21 21:07:36 +02:00
aria-label={i18n._('menu.mode')}
2024-07-07 18:26:52 +02:00
>
2025-06-08 16:32:41 +02:00
{#if mode.current === 'light'}
2025-10-20 19:53:42 +02:00
<Sun />
{:else}
2025-10-20 19:53:42 +02:00
<Moon />
{/if}
2024-07-07 18:26:52 +02:00
</Button>