mirror of
https://github.com/penxio/penx.git
synced 2026-04-19 03:03:06 -04:00
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import * as React from 'react'
|
|
import { cn } from '@/lib/utils'
|
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
|
|
const badgeVariants = cva(
|
|
'inline-flex items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: 'border-transparent bg-primary text-primary-foreground',
|
|
secondary:
|
|
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
destructive:
|
|
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
outline: 'text-foreground border',
|
|
},
|
|
|
|
size: {
|
|
default: 'h-7 px-2 text-xs',
|
|
sm: 'h-7 px-2 text-xs',
|
|
md: 'h-8 px-2 text-xs',
|
|
lg: 'h-9 px-2 text-sm',
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: 'default',
|
|
size: 'default',
|
|
},
|
|
},
|
|
)
|
|
|
|
export interface BadgeProps
|
|
extends React.HTMLAttributes<HTMLDivElement>,
|
|
VariantProps<typeof badgeVariants> {}
|
|
|
|
function Badge({ className, variant, size, ...props }: BadgeProps) {
|
|
return (
|
|
<div
|
|
className={cn(badgeVariants({ variant, size }), className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|