refactor: simplify settings page layout

This commit is contained in:
2026-03-09 14:19:59 -04:00
parent a3e49dc918
commit 10eaf84329
2 changed files with 46 additions and 53 deletions
@@ -1,7 +1,5 @@
<script lang="ts">
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
import { page } from '$app/state';
import Separator from '$lib/components/ui/separator/separator.svelte';
let { children } = $props();
const items = [
@@ -12,40 +10,29 @@
{
title: 'Libraries',
url: '/settings/libraries'
},
{
title: 'Devices',
url: '/settings/devices'
}
];
</script>
<div class="flex h-[calc(100vh-var(--header-height)-2rem)] flex-col">
<h1 class="text-xl font-bold">Settings</h1>
<Separator class="my-4" />
<div class="flex flex-1 gap-6 overflow-hidden">
<div class="flex gap-8">
<Sidebar.Provider class="shrink-0">
<Sidebar.Inset>
<Sidebar.Content>
<Sidebar.Group class="flex flex-col gap-1">
{#each items as item}
<Sidebar.MenuItem class="w-48">
<Sidebar.MenuButton
class="rounded hover:bg-muted {page.url.pathname.endsWith(item.url)
? 'bg-muted'
: ''}"
>
{#snippet child({ props })}
<a href={item.url} {...props}>
<span class="text-base">{item.title}</span>
</a>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
{/each}
</Sidebar.Group>
</Sidebar.Content>
</Sidebar.Inset>
</Sidebar.Provider>
</div>
<Separator orientation="vertical" class="self-stretch" />
<div class="mx-2 mt-2 flex-1 overflow-auto">{@render children()}</div>
<div class="mt-6 flex flex-1 gap-8 overflow-hidden">
<nav class="flex w-48 shrink-0 flex-col gap-1">
{#each items as item}
<a
href={item.url}
class="rounded-md px-3 py-2 text-sm font-medium transition-colors hover:bg-muted {page.url.pathname.endsWith(item.url)
? 'bg-muted'
: 'text-muted-foreground'}"
>
{item.title}
</a>
{/each}
</nav>
<div class="flex-1 overflow-auto">{@render children()}</div>
</div>
</div>