import type {PaginationModel} from "../../../type/viewModel.ts"; export function Pagination({ totalItems, totalPages, currentPage, size = 10, onPageChange, }: PaginationModel) { if (totalItems === 0) { return null; } const startPage = Math.floor((currentPage - 1) / size) * size + 1; const endPage = Math.min(startPage + size - 1, totalPages); const pages = Array.from( {length: endPage - startPage + 1}, (_, idx) => startPage + idx ); return (
{pages.map(page => ( ))}
); }