32 lines
888 B
Svelte
32 lines
888 B
Svelte
<script lang="ts">
|
|||
|
|
import type { HTMLAttributes } from 'svelte/elements'
|
||
|
|
import { cn } from '$lib/utils/cn'
|
||
|
|
|
||
|
|
let {
|
||
|
|
class: className,
|
||
|
|
tone = 'neutral',
|
||
|
|
children,
|
||
|
|
...rest
|
||
|
|
}: HTMLAttributes<HTMLSpanElement> & {
|
||
|
|
tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger'
|
||
|
|
children?: import('svelte').Snippet
|
||
|
|
} = $props()
|
||
|
|
const toneClasses = {
|
||
|
|
neutral: 'border-border bg-surface-hover text-muted-fg',
|
||
|
|
primary: 'border-primary/30 bg-primary/15 text-primary',
|
||
|
|
success: 'border-success/30 bg-success/15 text-success',
|
||
|
|
warning: 'border-warning/30 bg-warning/15 text-warning',
|
||
|
|
danger: 'border-danger/30 bg-danger/15 text-danger',
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<span
|
||
|
|
class={cn(
|
||
|
|
'inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium',
|
||
|
|
toneClasses[tone],
|
||
|
|
className,
|
||
|
|
)}
|
||
|
|
{...rest}
|
||
|
|
>
|
||
|
|
{@render children?.()}
|
||
|
|
</span>
|