25 lines
689 B
TypeScript
25 lines
689 B
TypeScript
import type { ReactNode } from 'react'
|
|
import { cx } from './cx'
|
|
|
|
export type TagVariant = 'accent' | 'neutral' | 'outline'
|
|
|
|
const VARIANTS: Record<TagVariant, string> = {
|
|
accent: 'bg-accent-100 text-accent-800',
|
|
neutral: 'bg-neutral-100 text-neutral-800',
|
|
outline: 'border border-accent text-accent-700',
|
|
}
|
|
|
|
export function Tag({ variant, children, className }: { variant: TagVariant; children: ReactNode; className?: string }) {
|
|
return (
|
|
<span
|
|
className={cx(
|
|
'inline-flex items-center gap-1 text-[11px] font-medium tracking-wide px-2.5 py-[3px] whitespace-nowrap',
|
|
VARIANTS[variant],
|
|
className,
|
|
)}
|
|
>
|
|
{children}
|
|
</span>
|
|
)
|
|
}
|