Files
2026-08-07 09:40:16 +03:30

42 lines
1001 B
TypeScript

"use client";
export function Skeleton({ className = "" }: { className?: string }) {
return <div className={`skeleton ${className}`} />;
}
// اسکلتِ جدولِ در حالِ لود — با سطر/ستونِ دلخواه.
export function TableSkeleton({
rows = 5,
cols = 5,
}: {
rows?: number;
cols?: number;
}) {
return (
<div className="card p-2 overflow-hidden">
<table>
<thead>
<tr>
{Array.from({ length: cols }).map((_, i) => (
<th key={i}>
<Skeleton className="h-3 w-16" />
</th>
))}
</tr>
</thead>
<tbody>
{Array.from({ length: rows }).map((_, r) => (
<tr key={r}>
{Array.from({ length: cols }).map((_, c) => (
<td key={c}>
<Skeleton className="h-3.5 w-24" />
</td>
))}
</tr>
))}
</tbody>
</table>
</div>
);
}