8000 MWPW-174488 [Gnav Performance] Dark Theme for Ghost state by sharmrj · Pull Request #4404 · adobecom/milo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MWPW-174488 [Gnav Performance] Dark Theme for Ghost state #4404

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

Merged
merged 7 commits into from
Jul 5, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions libs/blocks/global-navigation/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@

/* App banner */
--app-banner-height: 76px;

/* Skeleton loading state */
--feds-skeleton-color-1: #D3D3D3;
--feds-skeleton-color-2: #EAEAEA;
--feds-skeleton-color-3: #D3D3D3;
--feds-skeleton-opacity: 0.7;
}

/* Nav Link styles */
Expand Down
6 changes: 6 additions & 0 deletions libs/blocks/global-navigation/dark-nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
/* mobile gnav redesign */
--feds-borderColor-link-v2: #323232;
--feds-borderColor-localnav-v2: #323232;

/* Skeleton loading state - dark theme */
--feds-skeleton-color-1: #2c2c2c;
--feds-skeleton-color-2: #3a3a3a;
--feds-skeleton-color-3: #2c2c2c;
--feds-skeleton-opacity: 0.5;
}

.feds--dark .feds-navLink--hoverCaret:hover,
Expand Down
4 changes: 2 additions & 2 deletions libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -1465,8 +1465,8 @@ header.new-nav .feds-nav > section.feds-navItem > .feds-popup.loading .feds-navL
header.new-nav .feds-nav > section.feds-navItem > .feds-popup.loading .feds-navLink-content .feds-navLink-description,
header.new-nav .feds-nav > section.feds-navItem > .feds-popup.loading .tabs button > div {
border-radius: 2px;
opacity: 0.7;
background: linear-gradient(270deg, #D3D3D3, #EAEAEA, #D3D3D3);
opacity: var(--feds-skeleton-opacity);
background: linear-gradient(270deg, var(--feds-skeleton-color-1), var(--feds-skeleton-color-2), var(--feds-skeleton-color-3));
background-size: 200% 200%;
animation: mega-menu-skeleton 0.6s infinite alternate linear;
animation-direction: alternate;
Expand Down
58 changes: 30 additions & 28 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1390,34 +1390,36 @@ class Gnav {
clearTimeout(decorationTimeout);

const loadingDesktopMegaMenuHTML = template.querySelector('.feds-popup.loading')?.innerHTML;
const menuLogic = await loadDecorateMenu();

menuLogic.decorateMenu({
item,
template,
type: itemType,
}).then(async () => {
// There are two calls to transformTemplateToMobile
// One without awaiting decorateMenu, and one after
// decorateMenu is complete
const popup = template.querySelector('.feds-popup');
desktopMegaMenuHTML = popup.innerHTML;
if (!this.newMobileNav) return;
if (isDesktop.matches || !popup) return;
mobileNavCleanup();
mobileNavCleanup = await transformTemplateToMobile({
popup,
item,
localnav: this.isLocalNav(),
toggleMenu: this.toggleMenuMobile,
});
if (popup.closest('section.feds-dropdown--active')) makeTabActive(popup);
}).finally(() => {
if (this.isLocalNav()) {
decorateLocalNavItems(item, template);
}
});
(async () => {
try {
const menuLogic = await loadDecorateMenu();

await menuLogic.decorateMenu({
item,
template,
type: itemType,
});
// There are two calls to transformTemplateToMobile
// One without awaiting decorateMenu, and one after
// decorateMenu is complete
const popup = template.querySelector('.feds-popup');
desktopMegaMenuHTML = popup.innerHTML;
if (!this.newMobileNav) return;
if (isDesktop.matches || !popup) return;
mobileNavCleanup();
mobileNavCleanup = await transformTemplateToMobile({
popup,
item,
localnav: this.isLocalNav(),
toggleMenu: this.toggleMenuMobile,
});
if (popup.closest('section.feds-dropdown--active')) makeTabActive(popup);
} finally {
if (this.isLocalNav()) {
decorateLocalNavItems(item, template);
}
}
})();
if (this.newMobileNav) {
const popup = template.querySelector('.feds-popup');
if (!isDesktop.matches && popup) {
Expand Down Expand Up @@ -1644,12 +1646,12 @@ export default async function init(block) {
newMobileNav,
});
if (newMobileNav && !isDesktop.matches) block.classList.add('new-nav');
if (isDarkMode()) block.classList.add('feds--dark');
await gnav.init();
if (gnav.isLocalNav()) block.classList.add('local-nav');
block.setAttribute('daa-im', 'true');
const mepMartech = mep?.martech || '';
block.setAttribute('daa-lh', `gnav|${getExperienceName()}${mepMartech}`);
if (isDarkMode()) block.classList.add('feds--dark');
performance.mark('Gnav-Init-End');
logPerformance('Gnav-Init-Function-Time', 'Gnav-Start', 'Gnav-Init-End');
return gnav;
Expand Down
3 changes: 2 additions & 1 deletion libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,11 @@ export const transformTemplateToMobile = async ({ popup, item, localnav = false,
const notMegaMenu = popup.parentElement.tagName === 'DIV';
if (notMegaMenu) return () => {};

const isLoading = popup.classList.contains('loading');
const tabs = [...popup.querySelectorAll('.feds-menu-section')]
.filter((section) => !section.querySelector('.feds-promo') && section.textContent)
.map(parseTabsFromMenuSection)
.concat(await promoCrossCloudTab(popup));
.concat(isLoading ? [] : await promoCrossCloudTab(popup));

const CTA = popup.querySelector('.feds-cta--primary')?.outerHTML ?? '';
const mainMenu = `
Expand Down
Loading
0