mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-01 16:46:36 +08:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import * as React from "react";
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const badgeVariants = cva(
|
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "border-transparent bg-primary text-primary-foreground",
|
|
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
destructive: "border-transparent bg-danger text-white",
|
|
outline: "text-foreground",
|
|
success: "border-transparent bg-success text-white",
|
|
warning: "border-transparent bg-warning text-white",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
},
|
|
);
|
|
|
|
function Badge({
|
|
className,
|
|
variant,
|
|
...props
|
|
}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
return (
|
|
<span
|
|
className={cn(badgeVariants({ className, variant }))}
|
|
data-slot="badge"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { Badge, badgeVariants };
|