Change when totalWords is evaluated in Pagination

This commit is contained in:
Robbie Antenesse 2018-02-21 23:16:41 -07:00
parent 38c8f2dcd1
commit 7eb656d376
2 changed files with 6 additions and 4 deletions

View File

@ -113,8 +113,7 @@ export class MainDisplay extends Component {
<Pagination <Pagination
currentPage={currentPage} currentPage={currentPage}
itemsPerPage={itemsPerPage} itemsPerPage={itemsPerPage}
totalWords={stats.hasOwnProperty('numberOfWords') stats={stats}
? stats.numberOfWords.find(group => group.name === 'Total').value : null}
setPage={ setPage } /> setPage={ setPage } />
</RightColumn> </RightColumn>

View File

@ -5,12 +5,15 @@ export const Pagination = (props) => {
PropTypes.checkPropTypes({ PropTypes.checkPropTypes({
currentPage: PropTypes.number.isRequired, currentPage: PropTypes.number.isRequired,
itemsPerPage: PropTypes.number.isRequired, itemsPerPage: PropTypes.number.isRequired,
totalWords: PropTypes.number, stats: PropTypes.number,
setPage: PropTypes.func.isRequired, setPage: PropTypes.func.isRequired,
}, props, 'prop', 'Pagination'); }, props, 'prop', 'Pagination');
const { currentPage, itemsPerPage, totalWords, setPage } = props; const { currentPage, itemsPerPage, stats, setPage } = props;
const totalWords = stats.hasOwnProperty('numberOfWords')
? stats.numberOfWords.find(group => group.name === 'Total').value : null;
if (totalWords === null) { if (totalWords === null) {
return <div className="loader"></div>; return <div className="loader"></div>;
} }