design: update border handling for tabbutton
This commit is contained in:
1 file changed
+9
-1
@@ -2,9 +2,15 @@
|
||||
import type { Snippet } from 'svelte'
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
|
||||
const sizes = {
|
||||
sm: 'px-2.5 py-1',
|
||||
md: 'py-1.5 px-3.5',
|
||||
}
|
||||
|
||||
interface Props extends HTMLButtonAttributes {
|
||||
selected?: boolean
|
||||
children: Snippet
|
||||
size?: keyof typeof sizes
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
@@ -14,6 +20,7 @@
|
||||
disabled,
|
||||
children,
|
||||
href,
|
||||
size = 'sm',
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
@@ -21,7 +28,8 @@
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'button'}
|
||||
class={[
|
||||
'px-2.5 py-1 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer border shadow-xs',
|
||||
sizes[size],
|
||||
'rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer border shadow-xs',
|
||||
selected
|
||||
? 'border-transparent bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||
: ' dark:bg-zinc-900/50 bg-white border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800 active:bg-slate-200 active:dark:bg-zinc-900',
|
||||
|
||||
Reference in new issue
Block a user