/* Skeleton helpers — standardized loading shells. * * Use these instead of one-off `` so the * loading state matches the post-load layout. Each helper renders a * shape that approximates a specific final element. * * Available helpers: * • SkeletonRow — single line row (table row, list item) * • SkeletonRows — repeated rows with a stagger * • SkeletonCard — KPI / summary card body * • SkeletonChart — recharts placeholder of fixed height * • SkeletonHeader — page sub-section title placeholder */ import { cn } from '@/lib/utils'; import { Skeleton } from '@/components/ui/skeleton'; interface SkeletonProps { className?: string; } export function SkeletonRow({ className }: SkeletonProps) { return (
); } export function SkeletonRows({ count = 5, className }: SkeletonProps & { count?: number }) { return (
{Array.from({ length: count }).map((_, i) => ( ))}
); } export function SkeletonCard({ className }: SkeletonProps) { return (
); } export function SkeletonChart({ className, height = 180, }: SkeletonProps & { height?: number }) { return (
); } export function SkeletonHeader({ className }: SkeletonProps) { return (
); } /** SkeletonTable — header row + N body rows. Wrap in Card with p-0 for best fit. */ export function SkeletonTable({ rows = 5, cols = 4, className, }: SkeletonProps & { rows?: number; cols?: number }) { return (
{Array.from({ length: cols }).map((_, i) => ( ))}
{Array.from({ length: rows }).map((_, i) => (
{Array.from({ length: cols }).map((_, j) => ( ))}
))}
); }