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 ( +| + {header} + | + ))} +
|---|