2025-01-18 23:06:09 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import '../app.css';
|
2025-01-21 15:22:19 +02:00
|
|
|
import '@fontsource-variable/smooch-sans';
|
2025-01-21 17:39:17 +02:00
|
|
|
import '@fontsource-variable/kode-mono';
|
2025-01-21 15:22:19 +02:00
|
|
|
|
2025-01-21 17:39:17 +02:00
|
|
|
import { ModeWatcher, resetMode, setMode } from 'mode-watcher';
|
2025-01-21 15:22:19 +02:00
|
|
|
import { Button } from '$lib/components/ui/button/index.js';
|
2025-01-21 17:39:17 +02:00
|
|
|
|
2025-01-21 15:22:19 +02:00
|
|
|
import Sun from 'lucide-svelte/icons/sun';
|
|
|
|
import Moon from 'lucide-svelte/icons/moon';
|
2025-01-21 17:39:17 +02:00
|
|
|
import LaptopMinimal from 'lucide-svelte/icons/laptop-minimal';
|
2025-01-21 15:22:19 +02:00
|
|
|
|
2025-01-18 23:06:09 +02:00
|
|
|
let { children } = $props();
|
2025-01-21 17:39:17 +02:00
|
|
|
|
|
|
|
let theme: string = $state('system');
|
|
|
|
|
|
|
|
const cycleTheme = () => {
|
|
|
|
if (theme === 'dark') {
|
|
|
|
theme = 'light';
|
|
|
|
setMode('light');
|
|
|
|
} else if (theme === 'light') {
|
|
|
|
theme = 'system';
|
|
|
|
resetMode();
|
|
|
|
} else {
|
|
|
|
theme = 'dark';
|
|
|
|
setMode('dark');
|
|
|
|
}
|
|
|
|
};
|
2025-01-18 23:06:09 +02:00
|
|
|
</script>
|
|
|
|
|
2025-01-22 13:43:44 +02:00
|
|
|
<svelte:head>
|
|
|
|
<meta name="author" content="Mihkel Martin Kasterpalu" />
|
|
|
|
</svelte:head>
|
|
|
|
|
2025-01-21 15:22:19 +02:00
|
|
|
<ModeWatcher />
|
|
|
|
|
2025-01-22 17:05:21 +02:00
|
|
|
<header class="container flex w-full items-center justify-between px-8 py-6">
|
2025-01-21 15:22:19 +02:00
|
|
|
<a href="/">
|
2025-01-22 17:05:21 +02:00
|
|
|
<img src="/favicon.svg" alt="Mihkel Martin Kasterpalu logo" class="h-9" />
|
2025-01-21 15:22:19 +02:00
|
|
|
</a>
|
2025-01-22 17:05:21 +02:00
|
|
|
<Button onclick={() => cycleTheme()} variant="ghost" size="icon" class="h-12 w-12">
|
2025-01-21 17:39:17 +02:00
|
|
|
{#if theme === 'dark'}
|
2025-01-22 17:05:21 +02:00
|
|
|
<Moon class="!h-6 !w-6" />
|
2025-01-21 17:39:17 +02:00
|
|
|
{:else if theme === 'light'}
|
2025-01-22 17:05:21 +02:00
|
|
|
<Sun class="!h-6 !w-6" />
|
2025-01-21 17:39:17 +02:00
|
|
|
{:else}
|
2025-01-22 17:05:21 +02:00
|
|
|
<LaptopMinimal class="!h-6 !w-6" />
|
2025-01-21 17:39:17 +02:00
|
|
|
{/if}
|
|
|
|
|
2025-01-21 15:22:19 +02:00
|
|
|
<span class="sr-only">Toggle theme</span>
|
|
|
|
</Button>
|
|
|
|
</header>
|
|
|
|
|
2025-01-22 17:05:21 +02:00
|
|
|
<div class="container flex flex-col items-center">
|
2025-01-22 16:04:16 +02:00
|
|
|
{@render children()}
|
|
|
|
</div>
|