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
currentPage={currentPage}
itemsPerPage={itemsPerPage}
totalWords={stats.hasOwnProperty('numberOfWords')
? stats.numberOfWords.find(group => group.name === 'Total').value : null}
stats={stats}
setPage={ setPage } />
</RightColumn>

View File

@ -5,12 +5,15 @@ export const Pagination = (props) => {
PropTypes.checkPropTypes({
currentPage: PropTypes.number.isRequired,
itemsPerPage: PropTypes.number.isRequired,
totalWords: PropTypes.number,
stats: PropTypes.number,
setPage: PropTypes.func.isRequired,
}, 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) {
return <div className="loader"></div>;
}