pagination fix

This commit is contained in:
2022-02-25 08:51:12 +00:00
parent 2d97d6a1ce
commit 4d2e74514e
2 changed files with 14 additions and 8 deletions
+8 -5
View File
@@ -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 && (
<div className="govuk-!-margin-bottom-7 ">
<div className="govuk-grid-row paginationWrapper">
<div className="govuk-grid-column-one-quarter paginationPrevious">
{currentPage != 1 ? (
{props.currentView.currentPage != 1 ? (
<span
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
onClick={() => {
@@ -114,7 +117,7 @@ const PaginationControl = (props) => {
</div>
<div className="govuk-grid-column-one-half paginationContainer">
{paginationArray.map((e, i) =>
props.currentView.currentPage == i + 1 ? (
props.currentView.currentPage == e ? (
<span
key={i}
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
+6 -3
View File
@@ -34,6 +34,7 @@ const PaginationControl = (props) => {
};
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 && (
<div className="govuk-!-margin-bottom-7 ">
<div className="govuk-grid-row paginationWrapper">