import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import './PaginationArea.styl'; import { withTranslation } from '../../contextProviders'; class TablePagination extends PureComponent { static defaultProps = { pageOptions: [5, 10, 25, 50, 100], rowsPerPage: 25, currentPage: 0, }; static propTypes = { /* Values to show in "Rows per page" select dropdown */ pageOptions: PropTypes.array, rowsPerPage: PropTypes.number.isRequired, currentPage: PropTypes.number.isRequired, nextPageFunc: PropTypes.func, prevPageFunc: PropTypes.func, onRowsPerPageChange: PropTypes.func, recordCount: PropTypes.number.isRequired, }; nextPage = () => { this.props.nextPageFunc(this.props.currentPage); }; prevPage = () => { this.props.prevPageFunc(this.props.currentPage); }; onRowsPerPageChange = event => { this.props.onRowsPerPageChange(parseInt(event.target.value)); }; renderPaginationButtons() { return (
); } renderRowsPerPageDropdown() { return (
{this.props.t('Show')} {this.props.t('RowsPerPage')}
); } render() { return (
{this.renderRowsPerPageDropdown()}
{this.renderPaginationButtons()}
); } } const connectedComponent = withTranslation('Common')(TablePagination); export { connectedComponent as TablePagination };