2026-07-28 11:41:09 +07:00
|
|
|
"use client";
|
|
|
|
|
|
2026-07-26 16:14:32 +07:00
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
|
|
|
|
|
interface LoadingSkeletonProps {
|
|
|
|
|
count?: number;
|
|
|
|
|
height?: string;
|
2026-07-28 11:41:09 +07:00
|
|
|
width?: string;
|
2026-07-26 16:14:32 +07:00
|
|
|
columns?: number;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function LoadingSkeleton({
|
|
|
|
|
count = 4,
|
2026-07-28 11:41:09 +07:00
|
|
|
height = "h-24",
|
|
|
|
|
width,
|
|
|
|
|
columns,
|
2026-07-26 16:14:32 +07:00
|
|
|
className,
|
|
|
|
|
}: LoadingSkeletonProps) {
|
2026-07-28 11:41:09 +07:00
|
|
|
const items = Array.from({ length: count }, (_, i) => (
|
2026-07-26 16:14:32 +07:00
|
|
|
<div
|
2026-07-28 11:41:09 +07:00
|
|
|
key={i}
|
2026-07-26 16:14:32 +07:00
|
|
|
className={cn(
|
2026-07-28 11:41:09 +07:00
|
|
|
"glass rounded-[var(--radius-card)] overflow-hidden",
|
|
|
|
|
height,
|
|
|
|
|
width,
|
2026-07-26 16:14:32 +07:00
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-07-28 11:41:09 +07:00
|
|
|
<div className="w-full h-full animate-shimmer" />
|
2026-07-26 16:14:32 +07:00
|
|
|
</div>
|
2026-07-28 11:41:09 +07:00
|
|
|
));
|
|
|
|
|
|
|
|
|
|
if (columns) {
|
|
|
|
|
return (
|
|
|
|
|
<div className={`grid grid-cols-1 md:grid-cols-${columns} gap-3`}>
|
|
|
|
|
{items}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <div className="space-y-2">{items}</div>;
|
2026-07-26 16:14:32 +07:00
|
|
|
}
|