mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
![CleanShot 2025-12-08 at [email protected]](https://app.graphite.com/user-attachments/assets/43f13844-abe2-4a1b-bbc4-764554ca6634.png)
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { cva, type VariantProps } from 'class-variance-authority'
|
|
import * as React from 'react'
|
|
|
|
import { cn } from '@/lib/utils'
|
|
|
|
const badgeVariants = cva(
|
|
'inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold 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 shadow hover:bg-primary/80',
|
|
secondary:
|
|
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
destructive:
|
|
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
|
outline: 'text-foreground',
|
|
client:
|
|
'border-transparent bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 ring-1 ring-inset ring-blue-700/10 dark:ring-blue-300/20',
|
|
server:
|
|
'border-transparent bg-purple-50 dark:bg-purple-950 text-purple-700 dark:text-purple-300 ring-1 ring-inset ring-purple-700/10 dark:ring-purple-300/20',
|
|
polyfill:
|
|
'border-transparent bg-polyfill/10 dark:bg-polyfill/30 text-polyfill dark:text-polyfill-foreground ring-1 ring-inset ring-polyfill/20',
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: 'default',
|
|
},
|
|
}
|
|
)
|
|
|
|
export interface BadgeProps
|
|
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
VariantProps<typeof badgeVariants> {}
|
|
|
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
return (
|
|
<span className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
)
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|