From 6ba7bc9a413c7092455380abaa5321078e90c98d Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Fri, 17 Apr 2026 16:42:28 +0300 Subject: [PATCH] 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 --- .../web-dashboard/src/components/ui/badge.tsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 apps/web-dashboard/src/components/ui/badge.tsx diff --git a/apps/web-dashboard/src/components/ui/badge.tsx b/apps/web-dashboard/src/components/ui/badge.tsx new file mode 100644 index 0000000..777db9f --- /dev/null +++ b/apps/web-dashboard/src/components/ui/badge.tsx @@ -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) { + return ( + + ) +} + +export { Badge, badgeVariants }