Skip to content

Commit 0aba699

Browse files
committed
Refactoring high counts starting at 1 for mobile devices.
1 parent 67a6e5d commit 0aba699

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@department-of-veterans-affairs/component-library",
33
"description": "VA.gov component library. Includes React and web components.",
4-
"version": "49.1.2-rc2",
4+
"version": "49.1.1",
55
"license": "MIT",
66
"scripts": {
77
"build": "webpack"
@@ -16,7 +16,7 @@
1616
"module": "src/main.js",
1717
"dependencies": {
1818
"@department-of-veterans-affairs/react-components": "workspace:*",
19-
"@department-of-veterans-affairs/web-components": "17.1.2-rc2",
19+
"@department-of-veterans-affairs/web-components": "workspace:*",
2020
"i18next": "^21.6.14",
2121
"i18next-browser-languagedetector": "^6.1.4",
2222
"react-focus-on": "^3.5.1",

packages/web-components/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@department-of-veterans-affairs/web-components",
3-
"version": "17.1.2-rc2",
3+
"version": "17.1.1",
44
"description": "Stencil Component Starter",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.js",

packages/web-components/src/components/va-pagination/va-pagination.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export class VaPagination {
201201
// Use case #1: 6 or fewer pages
202202
return makeArray(1, totalPages);
203203
} else if (SHOW_ALL_PAGES < totalPages && totalPages <= maxPageListLength) {
204+
console.log('Use case 2');
204205
// Use case #2: Total pages is greater than 6 and less than or equal to
205206
// maxPageListLength. The logic has made affordances for max page list
206207
// lengths of 8 and below, and the default 10.
@@ -229,16 +230,18 @@ export class VaPagination {
229230

230231
return makeArray(start, end);
231232
} else if (currentPage <= radius - 1) {
233+
console.log('Use case 3');
234+
232235
// Use case #3: Current page is less than or equal to
233236
// half the visible pages minus one. This case always renders
234237
// [1] in pageNumbers array.
235238
start = 1;
236239

237240
switch (true) {
238-
case maxPageListLength <= totalPages && isMobileViewport:
239-
end = maxPageListLength - 4 - unboundedChar;
241+
case isMobileViewport && maxPageListLength <= totalPages:
242+
end = maxPageListLength - 5 - unboundedChar;
240243
break;
241-
case maxPageListLength < totalPages:
244+
case maxPageListLength <= totalPages:
242245
end = maxPageListLength - 1 - unboundedChar;
243246
break;
244247
default:
@@ -257,7 +260,7 @@ export class VaPagination {
257260
// current page gets close to the end.
258261

259262
switch (true) {
260-
case totalPages - maxPageListLength >= 0 && isMobileViewport:
263+
case isMobileViewport && totalPages - maxPageListLength >= 0:
261264
start = totalPages - (SHOW_ALL_PAGES - 2 - 1);
262265
break;
263266
case totalPages - maxPageListLength >= 0:

0 commit comments

Comments
 (0)