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

+7 -7
View File
@@ -18,7 +18,7 @@
hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
tertiary:
'border border-transparent bg-transparent hover:bg-slate-100 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
' bg-transparent hover:bg-slate-200/50 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
danger:
'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
@@ -47,9 +47,9 @@
export const buttonSize = {
xs: 'px-2 py-1 text-xs',
sm: 'px-3 py-1.5 text-[12px]',
md: 'px-3 py-1.5',
lg: 'px-4 py-2',
xl: 'px-6 py-3',
md: 'px-3 py-1.5 text-sm',
lg: 'px-4 py-2 text-sm',
xl: 'px-6 py-3 text-base',
'square-sm': 'w-6 h-6',
'square-md': 'w-8 h-8',
'square-lg': 'w-10 h-10',
@@ -105,7 +105,7 @@
size = 'md',
rounding = size == 'lg' ? 'xl' : 'lg',
alignment = 'center',
shadow = color != 'tertiary' ? 'sm' : 'none',
shadow = color != 'tertiary' ? 'none' : 'none',
column = false,
disabled,
loaderWidth = undefined,
@@ -129,7 +129,7 @@
buttonRounding[rounding],
buttonShadow[shadow],
buttonColor[color],
'text-sm transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none',
'transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none text-sm',
(disabled || loading) && 'pointer-events-none opacity-50 shadow-none',
alignment == 'center'
? 'origin-center'
@@ -144,7 +144,7 @@
class={[
'flex',
column ? 'flex-col justify-center' : 'flex-row items-center',
'h-full gap-1.5 button-content',
'h-full gap-1.5 button-content w-full',
buttonAlignment[alignment],
]}
>
+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,