AutoLoop / components /skeletons.tsx
shubhjn's picture
Deploy Clean V1
8dd52b2
// Loading Skeleton Components for Better UX
import { Card, CardContent, CardHeader } from "@/components/ui/card";
export function DashboardSkeleton() {
return (
<div className="space-y-6">
<div className="space-y-2">
<div className="h-8 w-64 bg-muted animate-pulse rounded" />
<div className="h-4 w-96 bg-muted animate-pulse rounded" />
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
{Array.from({ length: 4 }).map((_, i) => (
<Card key={i}>
<CardHeader className="space-y-2">
<div className="h-4 w-24 bg-muted animate-pulse rounded" />
<div className="h-8 w-32 bg-muted animate-pulse rounded" />
</CardHeader>
</Card>
))}
</div>
<Card>
<CardHeader>
<div className="h-6 w-48 bg-muted animate-pulse rounded" />
</CardHeader>
<CardContent>
<div className="space-y-3">
{Array.from({ length: 5 }).map((_, i) => (
<div key={i} className="h-12 bg-muted animate-pulse rounded" />
))}
</div>
</CardContent>
</Card>
</div>
);
}
export function TableSkeleton({ rows = 5 }: { rows?: number }) {
return (
<div className="space-y-3">
{Array.from({ length: rows }).map((_, i) => (
<div key={i} className="h-16 bg-muted animate-pulse rounded" />
))}
</div>
);
}
export function CardSkeleton() {
return (
<Card>
<CardHeader className="space-y-2">
<div className="h-5 w-32 bg-muted animate-pulse rounded" />
<div className="h-4 w-48 bg-muted animate-pulse rounded" />
</CardHeader>
<CardContent className="space-y-3">
<div className="h-4 w-full bg-muted animate-pulse rounded" />
<div className="h-4 w-3/4 bg-muted animate-pulse rounded" />
<div className="h-4 w-5/6 bg-muted animate-pulse rounded" />
</CardContent>
</Card>
);
}
export function FormSkeleton() {
return (
<div className="space-y-4">
{Array.from({ length: 4 }).map((_, i) => (
<div key={i} className="space-y-2">
<div className="h-4 w-24 bg-muted animate-pulse rounded" />
<div className="h-10 w-full bg-muted animate-pulse rounded" />
</div>
))}
<div className="h-10 w-32 bg-muted animate-pulse rounded" />
</div>
);
}