* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import {
|
|
TableNew,
|
|
TableBody,
|
|
TableCell,
|
|
TableHead,
|
|
TableHeader,
|
|
TableRow,
|
|
} from "@calcom/ui/components/table";
|
|
|
|
interface DataTableSkeletonProps {
|
|
columns: number;
|
|
rows?: number;
|
|
columnWidths?: number[];
|
|
}
|
|
|
|
export function DataTableSkeleton({ columns, rows = 10, columnWidths = [] }: DataTableSkeletonProps) {
|
|
return (
|
|
<div
|
|
className="grid h-[75dvh]"
|
|
style={{ gridTemplateRows: "auto 1fr auto", gridTemplateAreas: "'header' 'body' 'footer'" }}>
|
|
<div
|
|
className="scrollbar-thin border-subtle relative h-full overflow-auto rounded-md border"
|
|
style={{ gridArea: "body" }}>
|
|
<TableNew>
|
|
<TableHeader className="bg-subtle sticky top-0 z-10">
|
|
<TableRow>
|
|
{[...Array(columns)].map((_, index) => (
|
|
<TableHead key={`skeleton-header-${index}`}>
|
|
<div
|
|
className="bg-subtle h-4 animate-pulse rounded-md"
|
|
style={{ width: columnWidths[index] ? `${columnWidths[index]}px` : "200px" }}
|
|
/>
|
|
</TableHead>
|
|
))}
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{[...Array(rows)].map((_, rowIndex) => (
|
|
<TableRow key={`skeleton-row-${rowIndex}`}>
|
|
{[...Array(columns)].map((_, colIndex) => (
|
|
<TableCell key={`skeleton-cell-${rowIndex}-${colIndex}`}>
|
|
<div
|
|
className="bg-subtle h-6 animate-pulse rounded-md"
|
|
style={{ width: columnWidths[colIndex] ? `${columnWidths[colIndex]}px` : "200px" }}
|
|
/>
|
|
</TableCell>
|
|
))}
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</TableNew>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|