Skip to content

Commit

Permalink
Merge pull request #1028 from cagov/jbum-pagination-patch
Browse files Browse the repository at this point in the history
Pagination display fix.  @cagov/ds-pagination version 2.0.4
  • Loading branch information
jbum authored Aug 21, 2024
2 parents 3ea1a7a + 074bd78 commit 703b288
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions components/pagination/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Pagination changelog

## 2.0.4
- Fixes an issue with small page counts (4,5,6,7) in which on some page numbers
an ellipsis is displayed where a single-page is missing, or both the ellipsis and
a single page are skipped leaving a gap in the sequence. New system uses ellipsis for
2 or more pages only, and displays single pages in its place, when appropriate.

## 2.0.3

- Removed redundant package-lock.json (due to workspaces config in monorepo). This fixes vulnerability in the npm `ip` package.
Expand Down
6 changes: 5 additions & 1 deletion components/pagination/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
</li>
${currentPage > 2 ? pageListItem(page, 1) : ''}
${currentPage > 3 ? pageOverflow() : ''}
${currentPage > 4 ? pageOverflow() : ''}
${currentPage === 4 ? pageListItem(page, 2) : ''}
${currentPage > 1 ? pageListItem(page, currentPage - 1) : ''}
Expand All @@ -54,6 +55,9 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
${currentPage < totalPages ? pageListItem(page, currentPage + 1) : ''}
${currentPage < totalPages - 3 ? pageOverflow() : ''}
${
currentPage === totalPages - 3 ? pageListItem(page, totalPages - 1) : ''
}
${currentPage < totalPages - 1 ? pageListItem(page, totalPages) : ''}
Expand Down
2 changes: 1 addition & 1 deletion components/pagination/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cagov/ds-pagination",
"version": "2.0.3",
"version": "2.0.4",
"description": "",
"main": "dist/index.js",
"customElements": "custom-elements.json",
Expand Down
6 changes: 5 additions & 1 deletion components/pagination/src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
</li>
${currentPage > 2 ? pageListItem(page, 1) : ''}
${currentPage > 3 ? pageOverflow() : ''}
${currentPage > 4 ? pageOverflow() : ''}
${currentPage === 4 ? pageListItem(page, 2) : ''}
${currentPage > 1 ? pageListItem(page, currentPage - 1) : ''}
Expand All @@ -54,6 +55,9 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
${currentPage < totalPages ? pageListItem(page, currentPage + 1) : ''}
${currentPage < totalPages - 3 ? pageOverflow() : ''}
${
currentPage === totalPages - 3 ? pageListItem(page, totalPages - 1) : ''
}
${currentPage < totalPages - 1 ? pageListItem(page, totalPages) : ''}
Expand Down

0 comments on commit 703b288

Please sign in to comment.