Add ability to handle pages of different length, defaulting to 10
This commit is contained in:
parent
6175a30974
commit
b536ebda5b
@ -1,5 +1,5 @@
|
|||||||
module.exports = (collection, page) => {
|
module.exports = (collection, page, qty) => {
|
||||||
const itemsPerPage = 10;
|
const itemsPerPage = qty ? qty : 10;
|
||||||
const index = page * itemsPerPage;
|
const index = page * itemsPerPage;
|
||||||
const totalPages = Math.ceil(collection.size / itemsPerPage);
|
const totalPages = Math.ceil(collection.size / itemsPerPage);
|
||||||
let state = page === 0 ? 'first' : 'middle';
|
let state = page === 0 ? 'first' : 'middle';
|
||||||
|
Loading…
Reference in New Issue
Block a user