From f26dee782c07aa152d1cbb8235604e212e1997f9 Mon Sep 17 00:00:00 2001 From: Daniel Schulteis Date: Fri, 30 Jan 2026 22:20:18 +0100 Subject: [PATCH] change version von span to badge component --- app/(backend)/page.tsx | 5 +-- app/(backend)/users/page.tsx | 67 ++++++++++++++++++++++++------------ components/ui/badge.tsx | 48 ++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 24 deletions(-) create mode 100644 components/ui/badge.tsx diff --git a/app/(backend)/page.tsx b/app/(backend)/page.tsx index d99e071..5ed737d 100644 --- a/app/(backend)/page.tsx +++ b/app/(backend)/page.tsx @@ -2,6 +2,7 @@ import ModuleCard from "@/components/ModuleCard"; import StatCard from "@/components/StatCard"; +import { Badge } from "@/components/ui/badge"; import { ModuleCategory } from "@/lib/types/dashboard"; import { BookOpen, @@ -176,9 +177,9 @@ const Dashboard: React.FC = () => {

- + v2.4.0 Live - +
diff --git a/app/(backend)/users/page.tsx b/app/(backend)/users/page.tsx index b8504d4..8280907 100644 --- a/app/(backend)/users/page.tsx +++ b/app/(backend)/users/page.tsx @@ -16,7 +16,7 @@ export default function UsersPage() {

Users

Manage your community members and their permissions.

- @@ -52,27 +52,50 @@ export default function UsersPage() { {/* Example Row */} - -
-
JD
-
-
John Doe
-
john@example.com
-
-
- - - Administrator - - - Active - - Jan 29, 2026 - - - + +
+
JD
+
+
John Doe
+
john@example.com
+
+
+ + + Administrator + + + Active + + Jan 29, 2026 + + + + + + +
+
JD
+
+
Ivan Ivanowitsch
+
ivan@example.com
+
+
+ + + User + + + not active + + May 20, 2025 + + + diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx new file mode 100644 index 0000000..ba40cc1 --- /dev/null +++ b/components/ui/badge.tsx @@ -0,0 +1,48 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90", + secondary: + "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90", + destructive: + "bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + outline: + "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground", + ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground", + link: "text-primary underline-offset-4 [a&]:hover:underline", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +function Badge({ + className, + variant = "default", + asChild = false, + ...props +}: React.ComponentProps<"span"> & + VariantProps & { asChild?: boolean }) { + const Comp = asChild ? Slot : "span" + + return ( + + ) +} + +export { Badge, badgeVariants }