import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon } from "@radix-ui/react-icons"; import { Table } from "@tanstack/react-table"; import { Button } from "@app/components/ui/button"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@app/components/ui/select"; import { useTranslations } from "next-intl"; interface DataTablePaginationProps { table: Table; onPageSizeChange?: (pageSize: number) => void; } export function DataTablePagination({ table, onPageSizeChange }: DataTablePaginationProps) { const t = useTranslations(); const handlePageSizeChange = (value: string) => { const newPageSize = Number(value); table.setPageSize(newPageSize); // Call the callback if provided (for persistence) if (onPageSizeChange) { onPageSizeChange(newPageSize); } }; return (
{t('paginator', {current: table.getState().pagination.pageIndex + 1, last: table.getPageCount()})}
); }