From 21810373383795121965d7a8f44120c1249a3c65 Mon Sep 17 00:00:00 2001 From: Hector Hurtado Date: Tue, 23 May 2023 17:29:55 -0500 Subject: [PATCH 1/2] add wishlist toggling functionality --- assets/js/theme/wishlist.js | 6 ++++++ assets/scss/components/_components.scss | 3 ++- assets/scss/components/_wishlist-dropdown.scss | 14 ++++++++++++++ templates/components/common/wishlist-dropdown.html | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 assets/scss/components/_wishlist-dropdown.scss diff --git a/assets/js/theme/wishlist.js b/assets/js/theme/wishlist.js index 06da91cc7..952d3db23 100644 --- a/assets/js/theme/wishlist.js +++ b/assets/js/theme/wishlist.js @@ -3,6 +3,7 @@ import PageManager from './page-manager' import { wishlistPaginatorHelper } from './common/utils/pagination-utils' import { announceInputErrorMessage } from './common/utils/form-utils' import q$, { q$$ } from './global/selector' +import toggle from './custom/toggle' export default class WishList extends PageManager { constructor(context) { @@ -72,6 +73,11 @@ export default class WishList extends PageManager { this.registerAddWishListValidation($addWishListForm) } + const $addWishListDropdownButton = q$('.js-dropdown-menu-button') + if ($addWishListDropdownButton !== null) { + toggle('.js-dropdown-menu-button', { update: ['this', '#wishlist-dropdown'] }) + } + this.wishlistDeleteConfirm() } } diff --git a/assets/scss/components/_components.scss b/assets/scss/components/_components.scss index a38f7801b..d55ebb25b 100644 --- a/assets/scss/components/_components.scss +++ b/assets/scss/components/_components.scss @@ -15,4 +15,5 @@ @import "category"; @import "product"; @import "quick-search"; -@import "quick-search-results"; \ No newline at end of file +@import "quick-search-results"; +@import "wishlist-dropdown"; diff --git a/assets/scss/components/_wishlist-dropdown.scss b/assets/scss/components/_wishlist-dropdown.scss new file mode 100644 index 000000000..1cf929e2e --- /dev/null +++ b/assets/scss/components/_wishlist-dropdown.scss @@ -0,0 +1,14 @@ + +/* ========================================================================== + #WISHLIST-DROPDOWN + ========================================================================== */ + +.c-wishlist-dropdown { + > ul { + display: none; + + &.is-open { + display: block; + } + } +} diff --git a/templates/components/common/wishlist-dropdown.html b/templates/components/common/wishlist-dropdown.html index 09cb12f0f..07cfc5dea 100644 --- a/templates/components/common/wishlist-dropdown.html +++ b/templates/components/common/wishlist-dropdown.html @@ -1,4 +1,4 @@ -
+