metis-desk/packages/rdx-ui/src/components/entity-table-skeleton.tsx

24 lines
801 B
TypeScript
Raw Normal View History

import { Skeleton } from "@repo/shadcn-ui/components/skeleton";
import { TableCell, TableRow } from "@repo/shadcn-ui/components/table";
/** Reserva la primera página sin fabricar entidades, totales ni acciones accesibles. */
export function EntityTableSkeleton({
columns,
rows,
}: {
columns: readonly { id: string; className: string }[];
rows: number;
}) {
return Array.from({ length: Math.min(rows, 10) }, (_, index) => `placeholder-${index}`).map(
(id) => (
<TableRow aria-hidden="true" data-slot="entity-table-skeleton-row" key={id}>
{columns.map((column) => (
<TableCell className={column.className} key={column.id}>
<Skeleton className="h-3 w-3/4 motion-reduce:animate-none" />
</TableCell>
))}
</TableRow>
)
);
}