impr: merge mono-ui with photon (#455)

This commit is contained in:
Xylight authored and GitHub committed 2024-09-24 19:33:52 -07:00
1 parent 16075f72f2
commit 180d6fcc0d
40 files changed
+2024 -1

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
<script lang="ts">
import Button from '../button/Button.svelte'
type Route = string
type RouteObject = {
url: Route
children?: RouteObject[]
name: string
}
/**
* The routes for the routebar.
*/
export let routes: RouteObject[]
export let currentRoute: Route | undefined = undefined
export let parentRoute: Route | undefined = undefined
export let depth: number = 0
</script>
<svelte:element this={depth == 0 ? 'nav' : 'ul'} class="flex flex-col h-full">
{#each routes as route}
{#if route.children}
<Button
class="{depth > 0 ? 'pl-6' : ''} {route.url == currentRoute
? 'border-t-0 border-r-0 border-b-0 border-l !border-slate-900 dark:!border-zinc-50'
: 'border-t-0 border-r-0 border-b-0 border-l !border-slate-300 dark:!border-zinc-700'} rounded-l-none {depth ==
0
? 'mt-2'
: ''} font-bold"
href={route.url}
alignment="left"
color="tertiary"
size="lg"
>
{route.name}
</Button>
<svelte:self
routes={route.children}
{currentRoute}
{parentRoute}
depth={depth + 1}
/>
{:else}
<Button
href={route.url}
alignment="left"
color="tertiary"
size="lg"
class="{depth > 1 ? 'pl-12' : depth > 0 ? 'pl-6' : ''} {route.url ==
currentRoute
? 'border-t-0 border-r-0 border-b-0 border-l !border-slate-950 dark:!border-zinc-50'
: 'border-t-0 border-r-0 border-b-0 border-l !border-slate-300 dark:!border-zinc-700'} font-normal rounded-l-none"
>
{route.name}
</Button>
{/if}
{/each}
</svelte:element>