import React, { PureComponent } from "react"; import PropTypes from "prop-types"; import Button from "components/buttons/Button"; import FleetIcon from "components/icons/FleetIcon"; const baseClass = "pagination"; class Pagination extends PureComponent { static propTypes = { currentPage: PropTypes.number, resultsPerPage: PropTypes.number, onPaginationChange: PropTypes.func, resultsOnCurrentPage: PropTypes.number, disableNextPage: PropTypes.bool, }; disablePrev = () => { return this.props.currentPage === 0; }; disableNext = () => { // NOTE: not sure why resultsOnCurrentPage is getting assigned undefined. // but this seems to work when there is no data in the table. return ( this.props.resultsOnCurrentPage === undefined || this.props.resultsOnCurrentPage < this.props.resultsPerPage || this.props.disableNextPage ); }; render() { const { currentPage, onPaginationChange } = this.props; return (
); } } export default Pagination;