mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
We have no testing infrastructure, unfortunately <img width="2254" height="1260" alt="Bildschirmfoto 2026-05-28 um 20 29 58" src="https://github.com/user-attachments/assets/a9f1b646-994d-4417-98d7-160ce5249032" />
45 lines
1.8 KiB
TypeScript
45 lines
1.8 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',
|
|
traced:
|
|
'border-transparent bg-grey-50 dark:bg-grey-950 text-grey-700 dark:text-grey-300 ring-1 ring-inset ring-grey-700/10 dark:ring-grey-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 }
|