From 7eb656d37611551a5dc451d4c48e8d1be019240f Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 21 Feb 2018 23:16:41 -0700 Subject: [PATCH] Change when totalWords is evaluated in Pagination --- src/components/MainDisplay.jsx | 3 +-- src/components/structure/Pagination.jsx | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/MainDisplay.jsx b/src/components/MainDisplay.jsx index 984fb35..509acd2 100644 --- a/src/components/MainDisplay.jsx +++ b/src/components/MainDisplay.jsx @@ -113,8 +113,7 @@ export class MainDisplay extends Component { group.name === 'Total').value : null} + stats={stats} setPage={ setPage } /> diff --git a/src/components/structure/Pagination.jsx b/src/components/structure/Pagination.jsx index f3446e8..9ff7a31 100644 --- a/src/components/structure/Pagination.jsx +++ b/src/components/structure/Pagination.jsx @@ -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
; }