forked from bigcommerce/cornerstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storefront): BCTHEME-304 add pagination for wishlists (bigcommer…
- Loading branch information
1 parent
92ac7db
commit 232f0bb
Showing
6 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const changeWishlistPaginationLinks = (wishlistUrl, ...paginationItems) => $.each(paginationItems, (_, $item) => { | ||
const paginationLink = $item.children('.pagination-link'); | ||
|
||
if ($item.length && !paginationLink.attr('href').includes('page=')) { | ||
const pageNumber = paginationLink.attr('href'); | ||
paginationLink.attr('href', `${wishlistUrl}page=${pageNumber}`); | ||
} | ||
}); | ||
|
||
/** | ||
* helps to withdraw differences in structures around the stencil resource pagination | ||
*/ | ||
export const wishlistPaginatorHelper = () => { | ||
const $paginationList = $('.pagination-list'); | ||
|
||
if (!$paginationList.length) return; | ||
|
||
const $nextItem = $('.pagination-item--next', $paginationList); | ||
const $prevItem = $('.pagination-item--previous', $paginationList); | ||
const currentHref = $('[data-pagination-current-page-link]').attr('href'); | ||
const partialPaginationUrl = currentHref.split('page=').shift(); | ||
|
||
changeWishlistPaginationLinks(partialPaginationUrl, $prevItem, $nextItem); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
</li> | ||
{{/each}} | ||
</ul> | ||
{{> components/common/paginator wishlist.pagination}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters