design: fix classvalue (#560)
This commit is contained in:
1 parent
76c581123a
commit
3d509a6e28
14 files changed
+106
-81
No files matched your search
@@ -149,7 +149,7 @@
|
||||
rounding = size == 'lg' ? 'xl' : 'lg',
|
||||
roundingSide = 'all',
|
||||
alignment = 'center',
|
||||
shadow = 'none',
|
||||
shadow = 'sm',
|
||||
column = false,
|
||||
disabled,
|
||||
loaderWidth = undefined,
|
||||
@@ -185,11 +185,12 @@
|
||||
type={submit ? 'submit' : 'button'}
|
||||
>
|
||||
<div
|
||||
class="flex {column
|
||||
? 'flex-col justify-center'
|
||||
: 'flex-row items-center'} h-full gap-1.5 button-content {buttonAlignment[
|
||||
alignment
|
||||
]}"
|
||||
class={[
|
||||
'flex',
|
||||
column ? 'flex-col justify-center' : 'flex-row items-center',
|
||||
'h-full gap-1.5 button-content',
|
||||
buttonAlignment[alignment],
|
||||
]}
|
||||
>
|
||||
{#if loading}
|
||||
<Spinner width={loaderWidth ?? 16} />
|
||||
|
||||
@@ -101,11 +101,14 @@
|
||||
{...rest}
|
||||
{id}
|
||||
bind:this={element}
|
||||
class="{buttonSize[size]} {buttonShadow[
|
||||
shadow
|
||||
]} {buttonColor.secondary} appearance-none transition-colors rounded-lg text-sm
|
||||
w-full min-w-full cursor-pointer pr-6 {buttonColor.secondary}
|
||||
{clazz} {selectClass}"
|
||||
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()
|
||||
@@ -138,11 +141,20 @@
|
||||
}}
|
||||
size="custom"
|
||||
disabled={option.disabled}
|
||||
class="min-h-0! py-[5px]! {option.value == value
|
||||
? 'bg-slate-100! dark:bg-zinc-800!'
|
||||
: ''}"
|
||||
class={[
|
||||
'min-h-0! py-[5px]!',
|
||||
option.value == value &&
|
||||
'bg-slate-100! dark:bg-zinc-800! text-primary-900 dark:text-primary-100 font-medium!',
|
||||
]}
|
||||
>
|
||||
{#if option.icon}
|
||||
{#if option.value == value}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
size="16"
|
||||
micro
|
||||
class="text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{:else if option.icon}
|
||||
<Icon
|
||||
src={option.icon}
|
||||
size="16"
|
||||
@@ -151,14 +163,6 @@
|
||||
/>
|
||||
{/if}
|
||||
{@html option.label}
|
||||
{#if option.value == value}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
size="16"
|
||||
micro
|
||||
class="text-primary-900 dark:text-primary-100 ml-auto"
|
||||
/>
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
type ButtonProps,
|
||||
} from '../button/Button.svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
color?: ButtonColor
|
||||
alignment?: ButtonAlignment
|
||||
href?: string | undefined
|
||||
disabled?: boolean
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
icon?: IconSource
|
||||
prefix?: Snippet
|
||||
children?: Snippet
|
||||
@@ -37,21 +38,23 @@
|
||||
{...rest}
|
||||
{color}
|
||||
rounding="none"
|
||||
class="w-full px-2 rounded-lg min-h-8 font-normal {disabled
|
||||
? 'opacity-70 pointer-events-none cursor-not-allowed'
|
||||
: ''} {color == 'tertiary'
|
||||
? 'dark:hover:bg-zinc-800/70'
|
||||
: ''} duration-100 {clazz}"
|
||||
class={[
|
||||
'w-full px-2 rounded-lg min-h-8 font-normal duration-100',
|
||||
disabled && 'opacity-70 pointer-events-none cursor-not-allowed',
|
||||
color == 'tertiary' && 'dark:hover:bg-zinc-800/70',
|
||||
clazz,
|
||||
]}
|
||||
{alignment}
|
||||
{href}
|
||||
{disabled}
|
||||
shadow="none"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<div
|
||||
class="contents {color == 'tertiary'
|
||||
? 'text-slate-600 dark:text-zinc-400'
|
||||
: ''}
|
||||
shrink-0"
|
||||
class={[
|
||||
'contents shrink-0',
|
||||
color == 'tertiary' && 'text-slate-600 dark:text-zinc-400',
|
||||
]}
|
||||
>
|
||||
{#if icon}
|
||||
<Icon src={icon} micro size="16" />
|
||||
|
||||
Reference in new issue
Block a user