Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 645x 3x 32x 7x 29x 7x 29x | import { cn } from "../../lib/utils";
interface SkeletonProps {
className?: string;
}
/**
* Skeleton component for loading states
*/
export function Skeleton({ className }: SkeletonProps) {
return (
<div
className={cn("bg-background-muted rounded animate-pulse", className)}
/>
);
}
/**
* Skeleton for text/title
*/
export function SkeletonText({ className }: SkeletonProps) {
return <Skeleton className={cn("h-4 w-32", className)} />;
}
/**
* Skeleton for a card/row in a list
*/
export function SkeletonRow({ className }: SkeletonProps) {
return <Skeleton className={cn("h-16 w-full", className)} />;
}
/**
* Skeleton for loading a list of items
*/
interface SkeletonListProps {
count?: number;
rowClassName?: string;
}
export function SkeletonList({ count = 5, rowClassName }: SkeletonListProps) {
// Generate stable keys based on count to avoid array index key warning
// These are static placeholder elements without state
const keys = Array.from(
{ length: count },
(_, i) => `skeleton-row-${count}-${i}`,
);
return (
<div className="space-y-4">
{keys.map((key) => (
<SkeletonRow key={key} className={rowClassName} />
))}
</div>
);
}
|