From 386f817523abf812d4c94cb1e7e2051cc24a9863 Mon Sep 17 00:00:00 2001 From: Dev Ashish Saradhana <41122199+Deva309@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:52:31 +0530 Subject: [PATCH 1/6] [MWPW-151517] - Remove condition for promobar hidden on mobile from gnav (#2538) * Remove condition for promobar hidden on mobile from gnav * Fix lint and UT * Adjust height for feds promobar * brnach banner not shown in case feds promobar is present * Add UT for promobar hide/show on mobile * Lint Fix * Removed condition for on and off feds promobar on mobile to avoid CLS issue * Remove UT changes not needed now * fixed mega menu height if promobar is present * Fix review comments * Fix megamenu scroll issue * reverted condition * remove flex wrap * add initial visibility hidden for gnav --------- Co-authored-by: nishantka --- libs/blocks/global-navigation/global-navigation.css | 6 +++++- libs/blocks/global-navigation/global-navigation.js | 2 +- libs/blocks/mobile-app-banner/mobile-app-banner.js | 2 +- libs/styles/styles.css | 13 ++++++------- test/blocks/global-navigation/gnav-promo.test.js | 9 --------- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/libs/blocks/global-navigation/global-navigation.css b/libs/blocks/global-navigation/global-navigation.css index e35f3396e9..f4f28f00f0 100644 --- a/libs/blocks/global-navigation/global-navigation.css +++ b/libs/blocks/global-navigation/global-navigation.css @@ -84,7 +84,6 @@ header.global-navigation { /* Promo */ .global-navigation .aside.promobar { - display: none; /* For when someone switches from desktop to mobile */ z-index: 1; } @@ -569,6 +568,11 @@ header.global-navigation { padding: 40px 0 0; max-height: calc(100vh - 100%); overflow: auto; + box-sizing: border-box; + } + + .global-navigation.has-promo .feds-navItem--megaMenu .feds-popup { + max-height: calc(100vh - 100% - var(--global-height-navPromo)); } [dir = "rtl"] .feds-navItem--megaMenu .feds-popup { diff --git a/libs/blocks/global-navigation/global-navigation.js b/libs/blocks/global-navigation/global-navigation.js index 4bdab1954a..203c0ee9a9 100644 --- a/libs/blocks/global-navigation/global-navigation.js +++ b/libs/blocks/global-navigation/global-navigation.js @@ -777,7 +777,7 @@ class Gnav { decorateAside = async () => { this.elements.aside = ''; const promoPath = getMetadata('gnav-promo-source'); - if (!isDesktop.matches || !promoPath) { + if (!promoPath) { this.block.classList.remove('has-promo'); return this.elements.aside; } diff --git a/libs/blocks/mobile-app-banner/mobile-app-banner.js b/libs/blocks/mobile-app-banner/mobile-app-banner.js index 9d7106dd07..0e2e546b07 100644 --- a/libs/blocks/mobile-app-banner/mobile-app-banner.js +++ b/libs/blocks/mobile-app-banner/mobile-app-banner.js @@ -59,7 +59,7 @@ function branchInit(key) { /* eslint-enable */ export default async function init(el) { const header = document.querySelector('.global-navigation'); - if (!header) return; + if (!header || header.classList.contains('has-promo')) return; const classListArray = Array.from(el.classList); const product = classListArray.find((token) => token.startsWith('product-')).split('-')[1]; const key = await getKey(product); diff --git a/libs/styles/styles.css b/libs/styles/styles.css index 390675e445..4ef6d8c57f 100644 --- a/libs/styles/styles.css +++ b/libs/styles/styles.css @@ -4,7 +4,7 @@ --global-height-nav: 64px; --global-height-breadcrumbs: 33px; /* stylelint-disable-next-line custom-property-pattern */ - --global-height-navPromo: 65px; + --global-height-navPromo: 72px; --feds-totalheight-nav: calc(var(--feds-height-nav, --global-height-nav) + var(--feds-height-breadcrumbs, --global-height-breadcrumbs)); /* Colors */ @@ -708,13 +708,12 @@ header.global-navigation { visibility: hidden; } -@media (min-width: 900px) { - header.global-navigation.has-promo { - height: auto; - /* stylelint-disable-next-line custom-property-pattern */ - min-height: calc(var(--global-height-nav) + var(--global-height-navPromo)); - } +header.global-navigation.has-promo { + height: auto; + min-height: calc(var(--global-height-nav) + var(--global-height-navPromo)); +} +@media (min-width: 900px) { header.global-navigation.has-breadcrumbs { padding-bottom: var(--global-height-breadcrumbs); } diff --git a/test/blocks/global-navigation/gnav-promo.test.js b/test/blocks/global-navigation/gnav-promo.test.js index 6ef0276fb5..972dd297db 100644 --- a/test/blocks/global-navigation/gnav-promo.test.js +++ b/test/blocks/global-navigation/gnav-promo.test.js @@ -47,13 +47,4 @@ describe('Promo', () => { }); promoMeta.remove(); }); - - it('doesn\'t exist on mobile', async () => { - const promoMeta = toFragment``; - document.head.append(promoMeta); - const nav = await createFullGlobalNavigation({ viewport: 'mobile', hasPromo: true }); - expect(nav.block.classList.contains('has-promo')).to.be.false; - const asideElem = nav.block.querySelector('.aside.promobar'); - expect(asideElem).to.not.exist; - }); }); From 925af3f540de0aa68adb9a9ee5c74821e78ad160 Mon Sep 17 00:00:00 2001 From: Axel Cureno Basurto Date: Mon, 29 Jul 2024 01:22:38 -0700 Subject: [PATCH 2/6] Mwpw 147034: Custom border color + badge/border color decoupling [merch card] (#2613) * MWPW-147907: Allow for 24pt font size for price [Merch Card] * merch-card dependency consumption * Update merch-card.js * Update merch-card.js * Update merch-card.js --- libs/deps/merch-card.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/deps/merch-card.js b/libs/deps/merch-card.js index 145ea49b0b..6256234525 100644 --- a/libs/deps/merch-card.js +++ b/libs/deps/merch-card.js @@ -1,4 +1,3 @@ -// branch: main commit: edd23b3bf8505bfd02280d9ae77ece1ce3a25147 Wed, 24 Jul 2024 17:16:07 GMT import{html as o,LitElement as re,nothing as ne}from"/libs/deps/lit-all.min.js";import{LitElement as Q,html as M,css as Z}from"/libs/deps/lit-all.min.js";var h=class extends Q{static properties={size:{type:String,attribute:!0},src:{type:String,attribute:!0},alt:{type:String,attribute:!0},href:{type:String,attribute:!0}};constructor(){super(),this.size="m",this.alt=""}render(){let{href:e}=this;return e?M` ${this.alt} `:M` ${this.alt}`}static styles=Z` @@ -1492,7 +1491,7 @@ body.merch-modal { scrollbar-gutter: stable; height: 100vh; } -`;document.head.appendChild(K);var p="MERCH-CARD",f="merch-card",ae=32,_="mini-compare-chart",Y=c=>`--consonant-merch-card-footer-row-${c}-min-height`,l=class extends re{static properties={name:{type:String,attribute:"name",reflect:!0},variant:{type:String,reflect:!0},size:{type:String,attribute:"size",reflect:!0},badgeColor:{type:String,attribute:"badge-color"},borderColor:{type:String,attribute:"border-color"},badgeBackgroundColor:{type:String,attribute:"badge-background-color"},badgeText:{type:String,attribute:"badge-text"},actionMenu:{type:Boolean,attribute:"action-menu"},actionMenuContent:{type:String,attribute:"action-menu-content"},customHr:{type:Boolean,attribute:"custom-hr"},detailBg:{type:String,attribute:"detail-bg"},secureLabel:{type:String,attribute:"secure-label"},checkboxLabel:{type:String,attribute:"checkbox-label"},selected:{type:Boolean,attribute:"aria-selected",reflect:!0},storageOption:{type:String,attribute:"storage",reflect:!0},stockOfferOsis:{type:Object,attribute:"stock-offer-osis",converter:{fromAttribute:e=>{let[t,r,n]=e.split(",");return{PUF:t,ABM:r,M2M:n}}}},filters:{type:String,reflect:!0,converter:{fromAttribute:e=>Object.fromEntries(e.split(",").map(t=>{let[r,n,a]=t.split(":"),i=Number(n);return[r,{order:isNaN(i)?void 0:i,size:a}]})),toAttribute:e=>Object.entries(e).map(([t,{order:r,size:n}])=>[t,r,n].filter(a=>a!=null).join(":")).join(",")}},types:{type:String,attribute:"types",reflect:!0},merchOffer:{type:Object}};static styles=[q,...j()];customerSegment;marketSegment;constructor(){super(),this.filters={},this.types="",this.selected=!1}#e;updated(e){(e.has("badgeBackgroundColor")||e.has("borderColor"))&&(this.style.border=this.computedBorderStyle),this.updateComplete.then(async()=>{let t=Array.from(this.querySelectorAll('span[is="inline-price"][data-wcs-osi]'));await Promise.all(t.map(r=>r.onceSettled())),this.adjustTitleWidth(),this.adjustMiniCompareBodySlots(),this.adjustMiniCompareFooterRows()})}get computedBorderStyle(){return this.variant!=="twp"?`1px solid ${this.borderColor?this.borderColor:this.badgeBackgroundColor}`:""}get evergreen(){return this.classList.contains("intro-pricing")}get stockCheckbox(){return this.checkboxLabel?o`