import { Table } from '@tanstack/react-table'; import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons'; interface PaginationProps { table: Table; } export const Pagination = ({ table }: PaginationProps) => { return (
{table.getPageCount() <= 8 ? ( Array.from({ length: table.getPageCount() }, (_, index) => ( )) ) : ( <> {table.getState().pagination.pageIndex > 3 && ...} {Array.from( { length: 5 }, (_, index) => table.getState().pagination.pageIndex - 2 + index ) .filter((page) => page > 0 && page < table.getPageCount() - 1) .map((page) => ( ))} {table.getState().pagination.pageIndex < table.getPageCount() - 4 && ...} )}
); };