diff --git a/src/components/MainDisplay.jsx b/src/components/MainDisplay.jsx
index 51cae62..31c7ecc 100644
--- a/src/components/MainDisplay.jsx
+++ b/src/components/MainDisplay.jsx
@@ -18,6 +18,7 @@ export class MainDisplay extends Component {
dictionaryInfo: PropTypes.object.isRequired,
wordsToDisplay: PropTypes.array.isRequired,
wordsAreFiltered: PropTypes.bool,
+ wordsInCurrentList: PropTypes.number,
currentPage: PropTypes.number,
itemsPerPage: PropTypes.number,
stats: PropTypes.object.isRequired,
@@ -57,6 +58,7 @@ export class MainDisplay extends Component {
dictionaryInfo,
wordsToDisplay,
wordsAreFiltered,
+ wordsInCurrentList,
currentPage,
itemsPerPage,
stats,
@@ -105,6 +107,14 @@ export class MainDisplay extends Component {
)}
+
+
+ setPage={setPage}
+ wordsInCurrentList={wordsInCurrentList} />
diff --git a/src/components/structure/Pagination.jsx b/src/components/structure/Pagination/index.jsx
similarity index 78%
rename from src/components/structure/Pagination.jsx
rename to src/components/structure/Pagination/index.jsx
index e57fa12..83d4f64 100644
--- a/src/components/structure/Pagination.jsx
+++ b/src/components/structure/Pagination/index.jsx
@@ -1,24 +1,25 @@
import Inferno from 'inferno';
import PropTypes from 'prop-types';
+import './styles.scss';
+
export const Pagination = (props) => {
PropTypes.checkPropTypes({
currentPage: PropTypes.number.isRequired,
itemsPerPage: PropTypes.number.isRequired,
stats: PropTypes.object.isRequired,
setPage: PropTypes.func.isRequired,
+ wordsInCurrentList: PropTypes.number,
+ isTop: PropTypes.bool,
}, props, 'prop', 'Pagination');
- const { currentPage, itemsPerPage, stats, setPage } = props;
-
- const totalWords = stats.hasOwnProperty('numberOfWords')
- ? stats.numberOfWords.find(group => group.name === 'Total').value : null;
+ const { currentPage, itemsPerPage, stats, setPage, wordsInCurrentList, isTop } = props;
- if (totalWords === null) {
+ if (wordsInCurrentList === null) {
return
;
}
- const lastPage = Math.floor(totalWords / itemsPerPage);
+ const lastPage = Math.floor(wordsInCurrentList / itemsPerPage);
const nextPage = currentPage + 1 > lastPage ? lastPage : currentPage + 1;
const prevPage = currentPage - 1 < 0 ? 0 : currentPage - 1;
@@ -29,7 +30,7 @@ export const Pagination = (props) => {
}
return (
-