forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbadge.tsx
More file actions
33 lines (27 loc) 路 991 Bytes
/
Copy pathbadge.tsx
File metadata and controls
33 lines (27 loc) 路 991 Bytes
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
import * as React from "react"
import { cn } from "@/lib/utils"
type BadgeVariant = "default" | "secondary" | "destructive" | "outline"
const variantClasses: Record<BadgeVariant, string> = {
default: "border-transparent bg-primary text-primary-foreground",
secondary: "border-transparent bg-secondary text-secondary-foreground",
destructive: "border-transparent bg-destructive text-white",
outline: "text-foreground",
}
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
variant?: BadgeVariant
}
function Badge({ className, variant = "default", ...props }: BadgeProps) {
return (
<span
data-slot="badge"
className={cn(
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 gap-1 overflow-hidden transition-[color,box-shadow]",
variantClasses[variant],
className
)}
{...props}
/>
)
}
export { Badge }
export type { BadgeProps }