| 1 | import type { VariantProps } from 'class-variance-authority' |
| 2 | import { cva } from 'class-variance-authority' |
| 3 | import * as React from 'react' |
| 4 | |
| 5 | import { cn } from '@/utils/className' |
| 6 | |
| 7 | const badgeVariants = cva( |
| 8 | 'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', |
| 9 | { |
| 10 | variants: { |
| 11 | variant: { |
| 12 | default: 'border-transparent bg-gradient-back text-gradient-foreground shadow', |
| 13 | secondary: 'border-transparent bg-secondary text-secondary-foreground', |
| 14 | destructive: |
| 15 | 'border-transparent bg-destructive text-destructive-foreground shadow', |
| 16 | outline: 'text-foreground', |
| 17 | }, |
| 18 | }, |
| 19 | defaultVariants: { |
| 20 | variant: 'default', |
| 21 | }, |
| 22 | }, |
| 23 | ) |
| 24 | |
| 25 | export interface BadgeProps |
| 26 | extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {} |
| 27 | |
| 28 | function Badge({ className, variant, ...props }: BadgeProps) { |
| 29 | return <div className={cn(badgeVariants({ variant }), className)} {...props} /> |
| 30 | } |
| 31 | |
| 32 | export { Badge, badgeVariants } |
| 33 |