design: restructure andd redesign sidebar

This commit is contained in:
James Xylight committed 2025-08-23 14:59:35 -07:00
1 parent 0b3c1f7856
commit 0247d6dc4d
24 files changed
+281 -353

No files matched your search

+36 -34
View File
@@ -24,6 +24,7 @@
},
]
>
target?: Snippet
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
onchange?: HTMLSelectAttributes['onchange']
placement?: Placement
@@ -33,7 +34,7 @@
</script>
<script lang="ts" generics="T">
import { setContext, tick } from 'svelte'
import { setContext, tick, type Snippet } from 'svelte'
import {
CheckCircle,
ChevronUpDown,
@@ -87,10 +88,43 @@
oncontextmenu,
onchange,
placement = 'bottom',
target,
...rest
}: Props<T> = $props()
</script>
{#snippet selectTarget()}
<select
{...rest}
{id}
bind:this={element}
class={[
buttonSize[size],
buttonShadow[shadow],
buttonColor.secondary,
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
selectClass,
clazz,
]}
bind:value
onmousedown={e => {
e.preventDefault()
}}
onkeypress={e => {
e.preventDefault()
open = !open
}}
{onchange}
{oncontextmenu}
{placeholder}
>
{#if placeholder}
<option disabled selected value="">{placeholder}</option>
{/if}
{@render children?.()}
</select>
{/snippet}
<div class={['flex flex-col gap-1', clazz, baseClass]}>
{#if customLabel || label}
<Label for={id} text={label}>
@@ -99,39 +133,7 @@
{/if}
<div class="w-full relative">
<Menu bind:open {placement}>
{#snippet target()}
<select
{...rest}
{id}
bind:this={element}
class={[
buttonSize[size],
buttonShadow[shadow],
buttonColor.secondary,
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
selectClass,
clazz,
]}
bind:value
onmousedown={e => {
e.preventDefault()
}}
onkeypress={e => {
e.preventDefault()
open = !open
}}
{onchange}
{oncontextmenu}
{placeholder}
>
{#if placeholder}
<option disabled selected value="">{placeholder}</option>
{/if}
{@render children?.()}
</select>
{/snippet}
<Menu bind:open {placement} target={target ?? selectTarget}>
{#each context.options as option (option)}
{#if customOption}{@render customOption({
option,