import './pagination-controls.css'; import { generatePagesArray } from './generatePagesArray'; import { PageButton } from './PageButton'; import { PageInput } from './PageInput'; interface Props { boundaryLinks?: boolean; currentPage: number; directionLinks?: boolean; onPageChange(page: number): void; pageCount: number; maxSize: number; isInputVisible?: boolean; } export function PageSelector({ currentPage, pageCount, onPageChange, maxSize = 5, directionLinks = true, boundaryLinks = false, isInputVisible = false, }: Props) { const pages = generatePagesArray(currentPage, pageCount, maxSize); const last = pages[pages.length - 1]; if (pages.length <= 1) { return null; } return ( <> {isInputVisible && ( onPageChange(page)} totalPages={pageCount} /> )} ); }