"use client"; import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons"; import { Button, cn } from "@common/components"; export type VerificationResultHistoryPaginationProps = { pageCount: number; pageIndex: number; onPageIndexChange: (pageIndex: number) => void; className?: string; }; export function VerificationResultHistoryPagination({ pageCount, pageIndex: currentPage, onPageIndexChange, className, }: VerificationResultHistoryPaginationProps) { const maxVisiblePages = 10; let startPage = Math.max(0, currentPage - maxVisiblePages / 2); const endPage = Math.min(pageCount, startPage + maxVisiblePages); if (endPage - startPage < maxVisiblePages) { startPage = Math.max(0, endPage - maxVisiblePages); } const pageNumbers = Array(endPage - startPage) .fill(0) .map((_, i) => startPage + i); const canPrevious = currentPage > 0; const canNext = pageCount > 0 && currentPage < pageCount - 1; return (
{pageNumbers.map((pageNumber) => ( ))}
); }