/** * PolicyTablePagination * * Pagination controls for the Policy Explorer V2 data table. * * Features: * - Previous/Next buttons * - Page number display with jump-to-page * - Page size selector (10, 25, 50, 100) * - Total count display * - Disabled states for first/last page */ 'use client'; import { Button } from '@/components/ui/button'; import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react'; import type { Table } from '@tanstack/react-table'; import type { PolicySettingRow } from '@/lib/types/policy-table'; interface PolicyTablePaginationProps { table: Table; totalCount: number; pageCount: number; currentPage: number; } export function PolicyTablePagination({ table, totalCount, pageCount, currentPage, }: PolicyTablePaginationProps) { const pageSize = table.getState().pagination.pageSize; const canPreviousPage = currentPage > 0; const canNextPage = currentPage < pageCount - 1; // Calculate display range const startRow = currentPage * pageSize + 1; const endRow = Math.min((currentPage + 1) * pageSize, totalCount); return (
{totalCount === 0 ? ( 'No policy settings found' ) : ( <> Showing {startRow} to {endRow} of {totalCount} settings )}
{/* Page Size Selector */}

Rows per page

{/* Page Number Display */}
Page {currentPage + 1} of {pageCount}
{/* Navigation Buttons */}
{/* First Page */} {/* Previous Page */} {/* Next Page */} {/* Last Page */}
); }