Skip to content

Commit

Permalink
Merge branch 'main' into ebartholomew/aside-bg-image-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elan-tbx authored May 24, 2023
2 parents 5d0a3a7 + 8befe08 commit 7c811fa
Show file tree
Hide file tree
Showing 30 changed files with 406 additions and 302 deletions.
2 changes: 1 addition & 1 deletion libs/blocks/featured-article/featured-article.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
.featured-article-card-body h3 {
font-size: var(--type-heading-l-size);
color: var(--text-color);
line-height: var(--type-heading-l-lh);
line-height: var(--type-heading-base-lh);
margin: 0;
margin-bottom: 1rem;
overflow: hidden;
Expand Down
4 changes: 4 additions & 0 deletions libs/blocks/global-footer/global-footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
padding: 0;
}

.feds-footer-icons {
display: none;
}

/* Menu */
.feds-footer-wrapper .feds-menu-headline {
font-size: 14px;
Expand Down
14 changes: 11 additions & 3 deletions libs/blocks/global-footer/global-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Footer {
loadBaseStyles,
this.decorateGrid,
this.decorateProducts,
this.loadIcons,
this.decorateRegionPicker,
this.decorateSocial,
this.decoratePrivacy,
Expand Down Expand Up @@ -143,6 +144,13 @@ class Footer {
return this.elements.footerMenu;
};

loadIcons = async () => {
const file = await fetch(`${base}/blocks/global-footer/icons.svg`);
const content = await file.text();
const elem = toFragment`<div class="feds-footer-icons">${content}</div>`;
this.footerEl.append(elem);
};

decorateProducts = async () => {
this.elements.featuredProducts = '';

Expand Down Expand Up @@ -195,7 +203,7 @@ class Footer {
aria-haspopup="true"
role="button">
<svg xmlns="http://www.w3.org/2000/svg" class="feds-regionPicker-globe" focusable="false">
<use href="${base}/blocks/global-footer/icons.svg#globe" />
<use href="#footer-icon-globe" />
</svg>
${regionPickerTextElem}
</a>`;
Expand Down Expand Up @@ -255,7 +263,7 @@ class Footer {
const iconElem = toFragment`<li class="feds-social-item">
<a href="${link.href}#_dnb" class="feds-social-link" aria-label="${platform}">
<svg xmlns="http://www.w3.org/2000/svg" class="feds-social-icon" alt="${platform} logo">
<use href="${base}/blocks/global-footer/icons.svg#${platform}" />
<use href="#footer-icon-${platform}" />
</svg>
</a>
</li>`;
Expand Down Expand Up @@ -285,7 +293,7 @@ class Footer {
// Add Ad Choices icon
const adChoicesElem = privacyContent.querySelector('a[href*="#interest-based-ads"]');
adChoicesElem?.prepend(toFragment`<svg xmlns="http://www.w3.org/2000/svg" class="feds-adChoices-icon" focusable="false">
<use href="${base}/blocks/global-footer/icons.svg#adchoices" />
<use href="#footer-icon-adchoices" />
</svg>`);

this.elements.legal = toFragment`<div class="feds-footer-legalWrapper"></div>`;
Expand Down
24 changes: 12 additions & 12 deletions libs/blocks/global-footer/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion libs/blocks/global-navigation/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
transform: rotateZ(45deg);
transition: transform 0.1s ease;
content: "";
box-sizing: content-box;
}

[dir = "rtl"] .feds-navLink--hoverCaret {
Expand Down Expand Up @@ -96,7 +97,7 @@
.feds-navLink--hoverCaret {
position: static;
}

.feds-navLink--hoverCaret:after {
position: static;
margin-top: 0;
Expand Down
14 changes: 7 additions & 7 deletions libs/blocks/global-navigation/features/profile/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getConfig } from '../../../../utils/utils.js';
import { toFragment, getFedsPlaceholderConfig, trigger, closeAllDropdowns } from '../../utilities/utilities.js';
import { toFragment, getFedsPlaceholderConfig, trigger, closeAllDropdowns, logErrorFor } from '../../utilities/utilities.js';
import { replaceKeyArray } from '../../../../features/placeholders.js';

const getLanguage = (ietfLocale) => {
Expand Down Expand Up @@ -54,7 +54,7 @@ class ProfileDropdown {
this.sections = sections;
this.openOnInit = openOnInit;
this.localMenu = rawElem.querySelector('h5')?.parentElement;
this.init();
logErrorFor(this.init.bind(this), 'ProfileDropdown.init()');
}

async init() {
Expand Down Expand Up @@ -101,15 +101,15 @@ class ProfileDropdown {
// historically we shrunk the font size and displayed the account name on two lines;
// the email had some special logic as well;
// for MVP, we took a simpler approach ("Some very long name, very l...")
this.avatarElem = toFragment`<img
this.avatarElem = toFragment`<img
class="feds-profile-img"
src="${this.avatar}"
tabindex="0"
aria-label="${this.placeholders.profileAvatar}"
data-url="${decorateProfileLink('account', `profile?lang=${lang}`)}"></img>`;
return toFragment`
<div id="feds-profile-menu" class="feds-profile-menu">
<a
<a
href="${decorateProfileLink('account', `?lang=${lang}`)}"
class="feds-profile-header"
daa-ll="${this.placeholders.viewAccount}"
Expand Down Expand Up @@ -172,11 +172,11 @@ class ProfileDropdown {
}

addEventListeners() {
this.buttonElem.addEventListener('click', () => trigger({ element: this.buttonElem }));
this.buttonElem.addEventListener('click', (e) => trigger({ element: this.buttonElem, event: e }));
this.buttonElem.addEventListener('keydown', (e) => e.code === 'Escape' && closeAllDropdowns());
this.dropdown.addEventListener('keydown', (e) => e.code === 'Escape' && closeAllDropdowns());
this.avatarElem.addEventListener('click', (event) => {
event.preventDefault();
this.avatarElem.addEventListener('click', (e) => {
e.preventDefault();
window.location.assign(this.avatarElem.dataset?.url);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
top: 100%;
left: 0;
right: 0;
border-top: 1px solid var(--feds-borderColor--light);
/* Relative to nav, not trigger, ensure top border is visible */
margin-top: 1px;
display: none;
z-index: 1;
}
Expand Down
3 changes: 2 additions & 1 deletion libs/blocks/global-navigation/features/search/gnav-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
getFedsPlaceholderConfig,
trigger,
closeAllDropdowns,
logErrorFor,
} from '../../utilities/utilities.js';
import { replaceKeyArray } from '../../../../features/placeholders.js';
import { getConfig } from '../../../../utils/utils.js';
Expand Down Expand Up @@ -43,7 +44,7 @@ class Search {
this.clearSearchForm();
});
observer.observe(this.trigger, { attributeFilter: ['aria-expanded'] });
this.init();
logErrorFor(this.init.bind(this), 'Search has failed loading');
}

async init() {
Expand Down
18 changes: 12 additions & 6 deletions libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ header.global-navigation {
z-index: 10;
background-color: var(--feds-background-nav--light);
visibility: visible;
box-sizing: content-box;
}

.feds-topnav-wrapper {
Expand Down Expand Up @@ -94,7 +95,9 @@ header.global-navigation {
flex-shrink: 0;
}

.feds-brand-image > * {
.feds-brand-image picture,
.feds-brand-image img,
.feds-brand-image svg {
width: 100%;
display: block;
}
Expand Down Expand Up @@ -298,11 +301,9 @@ header.global-navigation {
display: none;
right: 0;
top: 100%;
border: 1px solid #e1e1e1;
border-radius: 0 0 4px 4px;
background: #fafafa;
background-color: var(--feds-background-popup--light);
overflow: hidden;
box-shadow: 0 2px 6px -1px rgb(0 0 0 / 10%);
box-shadow: 0 3px 3px 0 rgb(0 0 0 / 20%);
line-height: 1.4;
white-space: nowrap;
z-index: 1;
Expand Down Expand Up @@ -342,6 +343,7 @@ header.global-navigation {

.feds-topnav-wrapper {
border-bottom: 1px solid var(--feds-borderColor--light);
box-sizing: border-box;
}

.feds-nav-wrapper {
Expand All @@ -351,6 +353,7 @@ header.global-navigation {
flex-grow: 1;
height: unset;
border-bottom: unset;
border-top: unset;
justify-content: space-between;
background-color: transparent;
}
Expand Down Expand Up @@ -394,6 +397,8 @@ header.global-navigation {
right: 0;
justify-content: center;
padding: 20px 0;
/* Relative to nav, not trigger, ensure top border is visible */
margin-top: 1px;
}

[dir = "rtl"] .feds-navItem--megaMenu .feds-popup {
Expand Down Expand Up @@ -500,6 +505,7 @@ header button.gnav-toggle {
}

header button.gnav-toggle::after {
color: var(--feds-color-link--light);
content: "\2630";
font-weight: 700;
}
Expand Down Expand Up @@ -533,7 +539,7 @@ header .app-launcher button svg {

header .app-launcher button:hover svg {
opacity: 1;
}
}

header .app-launcher {
display: none;
Expand Down
Loading

0 comments on commit 7c811fa

Please sign in to comment.