2025-05-16 15:54:17 +02:00
|
|
|
"use client";
|
2024-11-11 14:56:33 +01:00
|
|
|
|
2026-05-24 17:09:12 +02:00
|
|
|
import {TablePaginationNavigation} from "@/components/common/table-pagination-navigation";
|
|
|
|
|
import {TablePaginationSize} from "@/components/common/table-pagination-size";
|
2025-11-29 22:31:32 +01:00
|
|
|
import {cn} from "@/lib/utils";
|
2024-11-11 14:56:33 +01:00
|
|
|
|
|
|
|
|
interface tablePaginationProps {
|
2025-05-16 15:54:17 +02:00
|
|
|
className?: string;
|
|
|
|
|
table: any;
|
|
|
|
|
maxVisiblePages?: number;
|
|
|
|
|
pageSizeOptions?: number[];
|
2024-11-11 14:56:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function TablePagination(props: tablePaginationProps) {
|
2025-11-29 22:31:32 +01:00
|
|
|
const {className, table, maxVisiblePages = 3, pageSizeOptions = [10, 20, 30, 40, 50]} = props;
|
2024-11-11 14:56:33 +01:00
|
|
|
|
2026-02-12 15:48:51 +01:00
|
|
|
const totalPages = table.getPageCount();
|
|
|
|
|
|
|
|
|
|
if (totalPages <= 1) return null;
|
|
|
|
|
|
2024-11-11 14:56:33 +01:00
|
|
|
return (
|
2025-11-29 22:31:32 +01:00
|
|
|
<div
|
|
|
|
|
className={cn("flex gap-x-4", className)}
|
|
|
|
|
>
|
|
|
|
|
<TablePaginationSize table={table} pageSizeOptions={pageSizeOptions}/>
|
|
|
|
|
<TablePaginationNavigation table={table} maxVisiblePages={maxVisiblePages} className="justify-end mt-0"/>
|
2024-11-11 14:56:33 +01:00
|
|
|
</div>
|
2024-11-23 18:54:47 +01:00
|
|
|
);
|
2024-11-11 14:56:33 +01:00
|
|
|
}
|