From 27062717b8a4258de9a27c8288448a3e29adaaa2 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 8 Feb 2022 16:35:34 +0000 Subject: [PATCH] adjusted pagination and dropdown --- .env.local | 12 +- components/case/documents.js | 47 ++++---- components/case/pagination.js | 4 +- components/search/pagination.js | 152 +++++++++++++------------ components/search/searchresults.js | 53 +++++---- styles/sass/welshgov/_application.scss | 6 +- 6 files changed, 146 insertions(+), 128 deletions(-) diff --git a/.env.local b/.env.local index dc2349dc..5d750509 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/ //ESNR Tenant TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502 //WGO Tenant -//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5 +TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5 GRANT_TYPE = "client_credentials" HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c @@ -37,11 +37,11 @@ RELAYPATH = "test-pedw-hc" //Prod Oauth WGO -//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc -//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~ -//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ -//RELAYURI = "prod-pedw-ns.servicebus.windows.net" -//RELAYPATH = "prod-pedw-hc" +CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc +CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~ +RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ +RELAYURI = "prod-pedw-ns.servicebus.windows.net" +RELAYPATH = "prod-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 diff --git a/components/case/documents.js b/components/case/documents.js index 772b52fb..d450eaf2 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -61,29 +61,32 @@ const DocumentDetails = (props) => { ? t("case:documents-count-label-2") : t("case:documents-count-label-2a")}

-
-
- + {documentDetailsObj["@odata.count"] > 5 && ( +
+
+ +
-
+ )} +
diff --git a/components/case/pagination.js b/components/case/pagination.js index b6dbfbcc..1a6e6fb7 100644 --- a/components/case/pagination.js +++ b/components/case/pagination.js @@ -34,11 +34,11 @@ const PaginationControl = (props) => { let delta; if (pageCount <= showNoOfRecords) { // delta === 7: [1 2 3 4 5 6 7] - delta = showNoOfRecords; + delta = 4; } else { // delta === 2: [1 ... 4 5 6 ... 10] // delta === 4: [1 2 3 4 5 ... 10] - delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 6; + delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; } const range = { diff --git a/components/search/pagination.js b/components/search/pagination.js index cae939a3..0b878aba 100644 --- a/components/search/pagination.js +++ b/components/search/pagination.js @@ -30,15 +30,15 @@ const PaginationControl = (props) => { }; const paginationNumbers = (currentPage, pageCount) => { - //console.log(currentPage); let delta; + if (pageCount <= showNoOfRecords) { // delta === 7: [1 2 3 4 5 6 7] - delta = showNoOfRecords; + delta = 4; } else { // delta === 2: [1 ... 4 5 6 ... 10] // delta === 4: [1 2 3 4 5 ... 10] - delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 6; + delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4; } const range = { @@ -79,91 +79,93 @@ const PaginationControl = (props) => { return ( <> {" "} -
-
-
- {currentPage != 1 ? ( - { - spinnerState(), - getSearchPageResults( - currentPage - 1, - orderBy, - fieldSort - ); - }} - > - {t("common:previous-link-button")} - - ) : ( - - {t("common:previous-link-button")} - - )} -
-
- {paginationArray.map((e, i) => - currentPage == i + 1 ? ( + {pagesCount > 1 && ( +
+
+
+ {currentPage != 1 ? ( - {e} - - ) : e == "..." ? ( - - {e} - - ) : ( - { spinnerState(), getSearchPageResults( - i + 1, + currentPage - 1, orderBy, fieldSort ); }} > - {e} + {t("common:previous-link-button")} - ) - )} + ) : ( + + {t("common:previous-link-button")} + + )} +
+
+ {paginationArray.map((e, i) => + currentPage == i + 1 ? ( + + {e} + + ) : e == "..." ? ( + + {e} + + ) : ( + { + spinnerState(), + getSearchPageResults( + i + 1, + orderBy, + fieldSort + ); + }} + > + {e} + + ) + )} +
+
+ {currentPage != pagesCount ? ( + { + spinnerState(), + getSearchPageResults( + currentPage + 1, + orderBy, + fieldSort + ); + }} + > + {t("common:next-link-button")} + + ) : ( + + {" "} + {t("common:next-link-button")} + + )} +
-
- {currentPage != pagesCount ? ( - { - spinnerState(), - getSearchPageResults( - currentPage + 1, - orderBy, - fieldSort - ); - }} - > - {t("common:next-link-button")} - - ) : ( - - {" "} - {t("common:next-link-button")} - - )} +
+ {t("common:pages-label")} {currentPage}{" "} + {t("common:of-label")} {pagesCount}
-
- {t("common:pages-label")} {currentPage}{" "} - {t("common:of-label")} {pagesCount} -
-
+ )} ); }; diff --git a/components/search/searchresults.js b/components/search/searchresults.js index f92556d9..a5b59834 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -634,30 +634,39 @@ const SearchResults = (props) => { )}

)} -
-
- + {t( + "search:searchresults-show-records-label-a" + )} + {" "} + {t( + "search:searchresults-show-records-label-b" + )} + +
-
- {resultsArr.length > 0 ? ( + )} + {resultsArr.length > 5 ? ( ResultsView(resultsArr) ) : (
diff --git a/styles/sass/welshgov/_application.scss b/styles/sass/welshgov/_application.scss index 85b9d41c..0a488344 100644 --- a/styles/sass/welshgov/_application.scss +++ b/styles/sass/welshgov/_application.scss @@ -1869,7 +1869,11 @@ fade { // record selection #recordCountSelect { - text-align: right; + text-align: left; + + @media screen and (min-width: 768px) { + text-align: right; + } select { margin-right: 10px; margin-left: 10px;