diff --git a/components/case/pagination.js b/components/case/pagination.js index b44d38a8..20966176 100644 --- a/components/case/pagination.js +++ b/components/case/pagination.js @@ -36,6 +36,7 @@ const PaginationControl = (props) => { const paginationNumbers = (currentPage, pageCount) => { //console.log(currentPage); let delta; + if (pageCount <= 7) { // delta === 7: [1 2 3 4 5 6 7] delta = 7; @@ -43,7 +44,7 @@ const PaginationControl = (props) => { // delta === 2: [1 ... 4 5 6 ... 10] // delta === 4: [1 2 3 4 5 ... 10] //delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; - delta = currentPage > 4 && currentPage < pageCount - 3 ? 2 : 4; + delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; } const range = { @@ -79,15 +80,17 @@ const PaginationControl = (props) => { return pages; }; - const paginationArray = paginationNumbers(currentPage, pagesCount); - + const paginationArray = paginationNumbers( + props.currentView.currentPage, + pagesCount + ); return ( <> {pagesCount > 1 && (
- {currentPage != 1 ? ( + {props.currentView.currentPage != 1 ? ( { @@ -114,7 +117,7 @@ const PaginationControl = (props) => {
{paginationArray.map((e, i) => - props.currentView.currentPage == i + 1 ? ( + props.currentView.currentPage == e ? ( { }; const paginationNumbers = (currentPage, pageCount) => { + //console.log(currentPage); let delta; if (pageCount <= 7) { @@ -43,7 +44,7 @@ const PaginationControl = (props) => { // delta === 2: [1 ... 4 5 6 ... 10] // delta === 4: [1 2 3 4 5 ... 10] //delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; - delta = currentPage > 4 && currentPage < pageCount - 3 ? 2 : 4; + delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; } const range = { @@ -79,10 +80,12 @@ const PaginationControl = (props) => { return pages; }; - const paginationArray = paginationNumbers(currentPage, pagesCount); + const paginationArray = paginationNumbers( + props.currentView.currentPage, + pagesCount + ); return ( <> - {" "} {pagesCount > 1 && (