29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import * as React from "react"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
const badgeVariants = cva(
|
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "border-transparent bg-trust-blue text-white",
|
|
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
success: "border-transparent bg-success-green/10 text-success-green",
|
|
warning: "border-transparent bg-warm-amber/10 text-warm-amber",
|
|
destructive: "border-transparent bg-danger-red/10 text-danger-red",
|
|
outline: "text-foreground",
|
|
},
|
|
},
|
|
defaultVariants: { variant: "default" },
|
|
}
|
|
)
|
|
|
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
|
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
return <div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|