70 lines
2.3 KiB
TypeScript
70 lines
2.3 KiB
TypeScript
// SkeletonTableFooter.tsx
|
||
|
||
/** Skeleton del footer de paginación, imita DataTablePagination */
|
||
export function SkeletonDataTableFooter({
|
||
pageIndex = 0,
|
||
pageSize = 10,
|
||
totalItems = 0,
|
||
}: {
|
||
pageIndex?: number; // 0-based
|
||
pageSize?: number;
|
||
totalItems?: number;
|
||
}) {
|
||
// Cálculo de rango (1-based visual)
|
||
const start = totalItems > 0 ? pageIndex * pageSize + 1 : 0;
|
||
const end = totalItems > 0 ? Math.min(start + pageSize - 1, totalItems) : 0;
|
||
|
||
return (
|
||
<div
|
||
aria-busy="true"
|
||
className="flex items-center justify-between border-t border-border px-2 py-2 bg-background"
|
||
role="status"
|
||
>
|
||
{/* Izquierda: rango visible */}
|
||
<div className="flex flex-col sm:flex-row items-center gap-4 flex-1 text-sm text-muted-foreground">
|
||
<span aria-live="polite">
|
||
{/* Texto real + shimmer leve para coherencia visual */}
|
||
{`Mostrando ${start}–${end} de ${totalItems} registros`}
|
||
</span>
|
||
|
||
{/* 'Filas por página' + trigger del select simulado */}
|
||
<div className="flex items-center gap-2">
|
||
<span>Filas por página</span>
|
||
<div
|
||
aria-hidden
|
||
className="h-8 w-20 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Derecha: controles de paginación simulados */}
|
||
<div className="flex items-center gap-2">
|
||
{/* Primera */}
|
||
<div
|
||
aria-hidden
|
||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||
/>
|
||
{/* Anterior */}
|
||
<div
|
||
aria-hidden
|
||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||
/>
|
||
{/* Indicador de página */}
|
||
<div className="h-5 w-28 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none" />
|
||
{/* Siguiente */}
|
||
<div
|
||
aria-hidden
|
||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||
/>
|
||
{/* Última */}
|
||
<div
|
||
aria-hidden
|
||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||
/>
|
||
</div>
|
||
|
||
<span className="sr-only">Loading pagination…</span>
|
||
</div>
|
||
);
|
||
}
|