feat: add sidebar collapsing

This commit is contained in:
Xyphyn committed 2023-07-31 12:53:57 -07:00
1 parent 13b5bcd581
commit 715c8f878b
4 files changed
+29 -9

No files matched your search

+22 -2
View File
@@ -1,6 +1,26 @@
<script lang="ts">
import { ChevronDoubleLeft, Icon } from 'svelte-hero-icons'
import Button from '../input/Button.svelte'
let expanded = true
</script>
<nav
class="hidden xl:flex flex-col pl-4 pr-4 py-4 overflow-auto sticky top-16 bottom-0
flex-1 gap-1 max-h-[calc(100vh-4rem)] w-full bg-slate-100 dark:bg-black"
gap-1 max-h-[calc(100vh-4rem)] w-full bg-slate-100 dark:bg-black"
class:flex-1={expanded}
class:w-max={!expanded}
>
<slot />
<Button
on:click={() => (expanded = !expanded)}
class="w-max !p-2 hover:bg-slate-200"
>
<Icon
src={ChevronDoubleLeft}
mini
size="16"
class="transition-transform {expanded ? '' : 'rotate-180'}"
/>
</Button>
<slot {expanded} />
</nav>