Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] Stage to Main #2965

Merged
merged 6 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 31 additions & 32 deletions libs/blocks/brick/brick.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
color: var(--color-white);
}

.brick.border {
border: 1px solid var(--color-gray-200);
}

.brick.click > a {
text-decoration: none;
}

.brick .background {
position: absolute;
bottom: 0;
Expand All @@ -30,7 +38,7 @@
}

.brick .foreground {
position: relative;
position: relative;
display: flex;
flex-grow: 1;
padding: var(--spacing-m);
Expand Down Expand Up @@ -116,17 +124,31 @@
.brick .foreground p.action-area {
display: flex;
flex-wrap: wrap;
gap: 24px;
gap: var(--spacing-s);
margin-top: var(--spacing-s);
}

.brick .icon-stack-area li,
.brick .icon-stack-area li a {
display: flex;
align-items: center;
gap: var(--spacing-xs);
text-align: start;
flex-shrink: 0;
}

.brick .icon-stack-area li picture {
display: flex;
margin: 0;
padding: 0;
flex-shrink: 0;
}

.brick .foreground a:not([class]),
.brick .foreground span.first-link {
font-weight: 700;
}

.brick .foreground .icon-area picture {
display: flex;
}
Expand All @@ -145,10 +167,6 @@
width: auto;
}

.brick.click > a {
text-decoration: none;
}

.brick .icon-stack-area {
display: flex;
flex-flow: row wrap;
Expand All @@ -165,25 +183,6 @@
width: auto;
}

.brick .icon-stack-area li,
.brick .icon-stack-area li a {
display: flex;
align-items: center;
gap: var(--spacing-xs);
text-align: left;
flex-shrink: 0;
}

.brick .foreground a:not([class]),
.brick .foreground span.first-link {
font-weight: 700;
}

[dir="rtl"] .brick .icon-stack-area li,
[dir="rtl"] .brick .icon-stack-area li a {
text-align: right;
}

.brick.click a.foreground .first-link:not([class*="button"]) {
color: var(--link-color);
text-decoration: none;
Expand Down Expand Up @@ -295,6 +294,12 @@
width: 41.66%;
}

.brick.split.row .foreground,
.brick.split.row .foreground .brick-media,
.brick.split.row .foreground picture {
border-radius: inherit;
}

.brick.split.horizontal-center .foreground .brick-text,
.brick.split.center .foreground .brick-text {
margin: 0;
Expand All @@ -320,12 +325,6 @@
grid-column: 8 / span 5;
}

.brick.split.row .foreground,
.brick.split.row .foreground .brick-media,
.brick.split.row .foreground picture {
border-radius: inherit;
}

.brick.stack .foreground .brick-media picture,
.brick.stack .foreground .brick-media img,
.brick.stack .foreground .brick-media video {
Expand All @@ -342,7 +341,7 @@
margin: 0;
position: absolute;
}

.brick .foreground .brick-media video,
.brick.split.row .foreground .brick-media video {
object-fit: fill;
Expand Down
6 changes: 5 additions & 1 deletion libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ header.global-navigation {
right: 20px; /* hamburger menu gutter */
display: none;
flex-direction: column;
height: 100vh;
height: calc(100vh - 100% - 1px);
border-top: 1px solid var(--feds-borderColor);
background-color: var(--feds-background-nav);
}
Expand Down Expand Up @@ -562,6 +562,10 @@ header.global-navigation {
flex-direction: initial;
}

.feds-navItem--mobile-only {
display: none;
}

.feds-navItem--megaMenu {
position: static;
}
Expand Down
40 changes: 35 additions & 5 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class Gnav {
constructor({ content, block } = {}) {
this.content = content;
this.block = block;
this.customLinks = getConfig()?.customLinks ? getConfig().customLinks.split(',') : [];

this.blocks = {
profile: {
Expand Down Expand Up @@ -639,9 +640,12 @@ class Gnav {
const state = getMetadata('app-prompt')?.toLowerCase();
const entName = getMetadata('app-prompt-entitlement')?.toLowerCase();
const promptPath = getMetadata('app-prompt-path')?.toLowerCase();
const hasMobileUA = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Touch/i.test(navigator.userAgent);

if (state === 'off'
|| !window.adobeIMS?.isSignedInUser()
|| !isDesktop.matches
|| hasMobileUA
|| !entName?.length
|| !promptPath?.length) return;

Expand Down Expand Up @@ -672,6 +676,11 @@ class Gnav {
const toggle = this.elements.mobileToggle;
const isExpanded = this.isToggleExpanded();
toggle?.setAttribute('aria-expanded', !isExpanded);
if (!isExpanded) {
document.body.classList.add('disable-scroll');
} else {
document.body.classList.remove('disable-scroll');
}
this.elements.navWrapper?.classList?.toggle('feds-nav-wrapper--expanded', !isExpanded);
closeAllDropdowns();
setCurtainState(!isExpanded);
Expand All @@ -696,7 +705,7 @@ class Gnav {
this.elements.mainNav.style.removeProperty('padding-bottom');
} else {
const offset = Math.ceil(this.elements.topnavWrapper.getBoundingClientRect().bottom);
this.elements.mainNav.style.setProperty('padding-bottom', `${offset}px`);
this.elements.mainNav.style.setProperty('padding-bottom', `${2 * offset}px`);
}
};

Expand All @@ -718,6 +727,7 @@ class Gnav {
if (isDesktop.matches) {
toggle.setAttribute('aria-expanded', false);
this.elements.navWrapper.classList.remove('feds-nav-wrapper--expanded');
document.body.classList.remove('disable-scroll');
setCurtainState(false);
closeAllDropdowns();
this.blocks?.search?.instance?.clearSearchForm();
Expand Down Expand Up @@ -836,7 +846,10 @@ class Gnav {

for await (const [index, item] of items.entries()) {
await yieldToMain();
this.elements.mainNav.appendChild(this.decorateMainNavItem(item, index));
const mainNavItem = this.decorateMainNavItem(item, index);
if (mainNavItem) {
this.elements.mainNav.appendChild(mainNavItem);
}
}

if (!hasActiveLink()) {
Expand All @@ -855,8 +868,9 @@ class Gnav {
// eslint-disable-next-line class-methods-use-this
getMainNavItemType = (item) => {
const itemTopParent = item.closest('div');
const isLinkGroup = !!item.closest('.link-group');
const hasSyncDropdown = itemTopParent instanceof HTMLElement
&& itemTopParent.childElementCount > 1;
&& !isLinkGroup && itemTopParent.childElementCount > 1;
if (hasSyncDropdown) return 'syncDropdownTrigger';
const hasAsyncDropdown = itemTopParent instanceof HTMLElement
&& itemTopParent.closest('.large-menu') instanceof HTMLElement;
Expand Down Expand Up @@ -945,6 +959,8 @@ class Gnav {
${decorateCta({ elem: item, type: itemType, index: index + 1 })}
</div>`, item);
case 'link': {
let customLinkModifier = '';
let removeCustomLink = false;
const linkElem = item.querySelector('a');
linkElem.className = 'feds-navLink';
linkElem.setAttribute('daa-ll', getAnalyticsValue(linkElem.textContent, index + 1));
Expand All @@ -956,11 +972,25 @@ class Gnav {
linkElem.setAttribute('tabindex', 0);
}

const customLinksSection = item.closest('.link-group');
if (customLinksSection) {
const removeLink = () => {
const url = new URL(linkElem.href);
linkElem.setAttribute('href', `${url.origin}${url.pathname}${url.search}`);
const linkHash = url.hash.slice(2);
return !this.customLinks.includes(linkHash);
};
[...customLinksSection.classList].splice(1).forEach((className) => {
customLinkModifier = ` feds-navItem--${className}`;
});
removeCustomLink = removeLink();
}

const linkTemplate = toFragment`
<div class="feds-navItem${activeModifier}">
<div class="feds-navItem${activeModifier}${customLinkModifier}">
${linkElem}
</div>`;
return addMepHighlightAndTargetId(linkTemplate, item);
return removeCustomLink ? null : addMepHighlightAndTargetId(linkTemplate, item);
}
case 'text':
return addMepHighlightAndTargetId(toFragment`<div class="feds-navItem feds-navItem--centered">
Expand Down
4 changes: 4 additions & 0 deletions libs/blocks/merch-card/merch-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ div[class*="-merch-card"] > div,
display: none;
}

merch-card .body-lower > hr {
width: 100%
}

.merch-card-price {
margin-top: 8px;
margin-bottom: 16px;
Expand Down
18 changes: 17 additions & 1 deletion libs/blocks/merch-card/merch-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,22 @@ const simplifyHrs = (el) => {
hr.parentElement.replaceWith(hr);
}
});
if (el.variant === PRODUCT) {
const calloutContent = el.querySelector('div[slot="callout-content"]');
const bodySlot = el.querySelector('div[slot="body-xs"]');
if (calloutContent && bodySlot) {
const bodyLowerContent = createTag('div', { slot: 'body-lower' });
const elements = [...bodySlot.children];
elements.forEach((element) => {
if (element.tagName !== 'P') {
bodyLowerContent.append(element);
}
});
if (bodyLowerContent.childNodes.length > 0) {
calloutContent.parentElement.appendChild(bodyLowerContent);
}
}
}
};

const getMiniCompareChartFooterRows = (el) => {
Expand Down Expand Up @@ -496,7 +512,7 @@ export default async function init(el) {
}
}
let footerRows;
if ([MINI_COMPARE_CHART, PLANS, SEGMENT].includes(cardType)) {
if ([MINI_COMPARE_CHART, PLANS, SEGMENT, PRODUCT].includes(cardType)) {
intersectionObserver.observe(merchCard);
}
if (cardType === MINI_COMPARE_CHART) {
Expand Down
298 changes: 204 additions & 94 deletions libs/deps/mas/mas.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Large diffs are not rendered by default.

Loading
Loading