Files
expenses/web/src/routes/+layout.svelte
T
2026-10-24 12:49:00 +02:00

46 lines
1.4 KiB
Svelte

<script lang="ts">
import './layout.css';
import favicon from '#lib/assets/favicon.svg';
import { resolve } from '$app/paths';
import { page } from '$app/state';
import type { LayoutProps } from './$types';
let { children }: LayoutProps = $props();
const menuItems = [
{ label: 'Dashboard', href: '/' },
{ label: 'Accounts', href: '/accounts' },
{ label: 'Scheduled transactions', href: '/scheduled-transactions' },
{ label: 'Transaction history', href: '/transaction-history' }
] as const;
</script>
<svelte:head>
<link rel="icon" href={favicon} />
</svelte:head>
<div class="grid min-h-dvh grid-cols-[max-content_1fr] gap-12 p-12">
<aside class="sticky top-0 h-dvh overflow-y-auto">
<div class="mb-8 text-2xl font-normal">Expenses</div>
<nav aria-label="Main navigation">
<ul class="flex flex-col gap-2">
{#each menuItems as item (item.href)}
<li>
<a
href={resolve(item.href)}
aria-current={page.url.pathname === resolve(item.href) ? 'page' : undefined}
class="block py-1 text-sm whitespace-nowrap text-neutral-400 no-underline hover:text-neutral-100 focus-visible:text-neutral-100 focus-visible:underline focus-visible:underline-offset-2 focus-visible:outline-none aria-[current=page]:text-neutral-100 aria-[current=page]:not-italic"
>
{item.label}
</a>
</li>
{/each}
</ul>
</nav>
</aside>
<main class="mx-auto w-full max-w-4xl min-w-0">
{@render children()}
</main>
</div>