import React from 'react'; import { Link } from 'react-router-dom'; import { Pagination, PaginationItem, PaginationLink } from 'reactstrap'; import { pageIsEllipsis, keyForPage, progressivePagination } from '../utils/helpers/pagination'; import { ShlinkPaginator } from '../utils/services/types'; import './Paginator.scss'; interface PaginatorProps { paginator?: ShlinkPaginator; serverId: string; } const Paginator = ({ paginator, serverId }: PaginatorProps) => { const { currentPage = 0, pagesCount = 0 } = paginator ?? {}; if (pagesCount <= 1) { return null; } const renderPages = () => progressivePagination(currentPage, pagesCount).map((pageNumber, index) => ( {pageNumber} )); return ( {renderPages()} = pagesCount}> ); }; export default Paginator;