mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-30 07:48:48 +00:00
feat: Add Badge component with six variants for status and category display
- Add Badge component using class-variance-authority for variant styling - Add six badge variants: default, secondary, destructive, outline, success, warning - Add success variant with emerald-500/10 background and emerald-600 text with dark mode support - Add warning variant with amber-500/10 background and amber-600 text with dark mode support - Add destructive variant with destructive/10 background for error states - Configure
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
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-md border px-2 py-0.5 text-xs font-medium transition-colors",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "border-transparent bg-primary text-primary-foreground",
|
||||||
|
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
||||||
|
destructive: "border-transparent bg-destructive/10 text-destructive",
|
||||||
|
outline: "text-foreground",
|
||||||
|
success: "border-transparent bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
||||||
|
warning: "border-transparent bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: { variant: "default" },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Badge({
|
||||||
|
className,
|
||||||
|
variant,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
||||||
|
return (
|
||||||
|
<span className={cn(badgeVariants({ variant }), className)} {...props} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Badge, badgeVariants }
|
||||||
Reference in New Issue
Block a user