import { Skeleton } from "@/components/ui/skeleton"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { cn } from "@/lib/utils"; interface DataTableSkeletonProps extends React.ComponentProps<"div"> { columnCount: number; rowCount?: number; filterCount?: number; cellWidths?: string[]; withViewOptions?: boolean; withPagination?: boolean; shrinkZero?: boolean; } export function DataTableSkeleton({ columnCount, rowCount = 10, filterCount = 0, cellWidths = ["auto"], withViewOptions = true, withPagination = true, shrinkZero = false, className, ...props }: DataTableSkeletonProps) { const cozyCellWidths = Array.from( { length: columnCount }, (_, index) => cellWidths[index % cellWidths.length] ?? "auto", ); return (
{filterCount > 0 ? Array.from({ length: filterCount }).map((_, i) => ( )) : null}
{withViewOptions ? ( ) : null}
{Array.from({ length: 1 }).map((_, i) => ( {Array.from({ length: columnCount }).map((_, j) => ( ))} ))} {Array.from({ length: rowCount }).map((_, i) => ( {Array.from({ length: columnCount }).map((_, j) => ( ))} ))}
{withPagination ? (
) : null}
); }