import React, { FC } from 'react'; import classNames from 'classnames'; import { Pagination, PaginationItem, PaginationLink } from 'reactstrap'; import { pageIsEllipsis, keyForPage, NumberOrEllipsis, progressivePagination, prettifyPageNumber, } from '../utils/helpers/pagination'; import './SimplePaginator.scss'; interface SimplePaginatorProps { pagesCount: number; currentPage: number; setCurrentPage: (currentPage: number) => void; centered?: boolean; } const SimplePaginator: FC = ({ pagesCount, currentPage, setCurrentPage, centered = true }) => { if (pagesCount < 2) { return null; } const onClick = (page: NumberOrEllipsis) => () => !pageIsEllipsis(page) && setCurrentPage(page); return ( {progressivePagination(currentPage, pagesCount).map((pageNumber, index) => ( {prettifyPageNumber(pageNumber)} ))} = pagesCount}> ); }; export default SimplePaginator;