diff --git a/src/components/admin/admin-table.tsx b/src/components/admin/admin-table.tsx new file mode 100644 index 0000000..ce353fd --- /dev/null +++ b/src/components/admin/admin-table.tsx @@ -0,0 +1,70 @@ +import { cn } from "@/lib/cn"; + +export function AdminTable({ + headers, + children, + empty, +}: { + headers: string[]; + children: React.ReactNode; + empty?: string; +}) { + const hasRows = Array.isArray(children) + ? children.length > 0 + : Boolean(children); + + if (!hasRows && empty) { + return ( +

+ {empty} +

+ ); + } + + return ( +
+ + + + {headers.map((header, index) => ( + + ))} + + + + {children} + +
+ {header} +
+
+ ); +} + +export function AdminCell({ + children, + align = "left", + className, +}: { + children: React.ReactNode; + align?: "left" | "right"; + className?: string; +}) { + return ( + + {children} + + ); +} \ No newline at end of file