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 { Snippet } from 'svelte'
|
||||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
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 {
|
interface Props extends HTMLButtonAttributes {
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
children: Snippet
|
children: Snippet
|
||||||
|
size?: keyof typeof sizes
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +20,7 @@
|
|||||||
disabled,
|
disabled,
|
||||||
children,
|
children,
|
||||||
href,
|
href,
|
||||||
|
size = 'sm',
|
||||||
...rest
|
...rest
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
@@ -21,7 +28,8 @@
|
|||||||
<svelte:element
|
<svelte:element
|
||||||
this={href ? 'a' : 'button'}
|
this={href ? 'a' : 'button'}
|
||||||
class={[
|
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
|
selected
|
||||||
? 'border-transparent bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
? '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',
|
: ' 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