import { cn } from "@/lib/utils" import { cva, type VariantProps } from "class-variance-authority" import * as React from "react" const badgeVariants = cva( "inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { default: "border-transparent bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-sm hover:bg-primary/80", secondary: "border-transparent bg-secondary/90 text-secondary-foreground backdrop-blur-sm shadow-sm hover:bg-secondary/80", destructive: "border-transparent bg-destructive/90 text-destructive-foreground backdrop-blur-sm shadow-sm hover:bg-destructive/80", outline: "border border-border/40 text-foreground bg-background/50 backdrop-blur-sm hover:bg-muted/20", success: "border-transparent bg-green-500/90 text-white backdrop-blur-sm shadow-sm hover:bg-green-500/80", warning: "border-transparent bg-amber-500/90 text-white backdrop-blur-sm shadow-sm hover:bg-amber-500/80", info: "border-transparent bg-blue-500/90 text-white backdrop-blur-sm shadow-sm hover:bg-blue-500/80", }, removable: { true: "pr-1", false: "", }, }, defaultVariants: { variant: "default", removable: false, }, } ) export interface BadgeProps extends React.HTMLAttributes, VariantProps { removable?: boolean onRemove?: () => void icon?: React.ReactNode } function Badge({ className, variant, removable, onRemove, icon, children, ...props }: BadgeProps) { return (
{icon && {icon}} {children} {removable && ( )}
) } export { Badge, badgeVariants }