import React from 'react';
import { Link } from 'react-router-dom';
import { Pagination, PaginationItem, PaginationLink } from 'reactstrap';
import PropTypes from 'prop-types';
import { ELLIPSIS, progressivePagination } from '../utils/utils';
const propTypes = {
serverId: PropTypes.string.isRequired,
paginator: PropTypes.shape({
currentPage: PropTypes.number,
pagesCount: PropTypes.number,
}),
};
const Paginator = ({ paginator = {}, serverId }) => {
const { currentPage, pagesCount = 0 } = paginator;
if (pagesCount <= 1) {
return null;
}
const renderPages = () =>
progressivePagination(currentPage, pagesCount).map((pageNumber, index) => (
{pageNumber}
));
return (
{renderPages()}
= pagesCount}>
);
};
Paginator.propTypes = propTypes;
export default Paginator;