forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPillTag.tsx
More file actions
39 lines (34 loc) · 1.01 KB
/
Copy pathPillTag.tsx
File metadata and controls
39 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// src/components/ui/PillTag.tsx
import { cva, type VariantProps } from "class-variance-authority"
import clsx from "clsx"
import type { HTMLAttributes } from "react"
const pillTagVariants = cva("nm-inset-sm bg-control-bg rounded-nm-pill font-mono", {
variants: {
color: {
accent: "text-accent",
warn: "text-warn",
danger: "text-danger",
secondary: "text-secondary",
tertiary: "text-tertiary",
muted: "text-muted",
},
size: {
sm: "px-1.5 py-0.5 text-3xs",
md: "px-3 py-1 text-xs",
},
},
defaultVariants: { color: "tertiary", size: "md" },
})
interface PillTagProps
extends Omit<HTMLAttributes<HTMLSpanElement>, "color">, VariantProps<typeof pillTagVariants> {
label?: string
}
function PillTag({ color, size, label, className, children, ...props }: PillTagProps) {
return (
<span className={clsx(pillTagVariants({ color, size }), className)} {...props}>
{label ?? children}
</span>
)
}
export type { PillTagProps }
export { PillTag }