2024-07-05 01:02:53 +02:00
|
|
|
<script lang="ts">
|
2025-02-02 11:17:22 +01:00
|
|
|
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
|
|
|
|
2025-02-02 11:17:22 +01:00
|
|
|
export let size = '20';
|
2024-07-05 01:02:53 +02:00
|
|
|
</script>
|
|
|
|
|
|
2024-07-07 18:26:52 +02:00
|
|
|
<Button
|
2025-02-02 11:17:22 +01:00
|
|
|
variant="ghost"
|
2025-06-21 21:07:36 +02:00
|
|
|
size="icon"
|
2025-02-02 11:17:22 +01:00
|
|
|
class="h-8 px-1.5 {$$props.class ?? ''}"
|
2025-06-21 21:07:36 +02:00
|
|
|
onclick={() => {
|
2025-06-08 16:32:41 +02:00
|
|
|
setMode(mode.current === 'light' ? 'dark' : 'light');
|
2025-02-02 11:17:22 +01:00
|
|
|
}}
|
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-02-02 11:17:22 +01:00
|
|
|
<Sun {size} />
|
|
|
|
|
{:else}
|
|
|
|
|
<Moon {size} />
|
|
|
|
|
{/if}
|
2024-07-07 18:26:52 +02:00
|
|
|
</Button>
|