Skip to content

Commit

Permalink
[MWPW-161782] - Added logo changes for older GNAV experience (#3162)
Browse files Browse the repository at this point in the history
* Added logo changes for older GNAV experience

* Lint Fix

* Logo alighned to left for older GNAV
  • Loading branch information
Deva309 authored Nov 12, 2024
1 parent d22e80b commit 82bf330
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 12 additions & 2 deletions libs/blocks/gnav/gnav.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ header button.gnav-toggle {
header .gnav-wrapper a.gnav-brand {
width: 56px;
grid-area: header;
justify-self: center;
display: flex;
justify-content: center;
align-items: center;
color: #eb1000;
font-size: 16px;
line-height: 16px;
font-weight: 700;
margin-left: 56px;
}

header .gnav-wrapper a.gnav-brand.brand-image-only {
width: auto;
}

header .gnav-wrapper a.gnav-brand.light {
Expand All @@ -125,6 +128,12 @@ header a.gnav-brand img {
width: 27px;
}

header a.gnav-brand.brand-image-only svg,
header a.gnav-brand.brand-image-only img {
width: auto;
height: 36px;
}

header span.gnav-brand-title {
display: none;
}
Expand Down Expand Up @@ -928,6 +937,7 @@ header .app-launcher {
width: unset;
grid-area: brand;
padding-right: 20px;
margin-left: auto;
}

.gnav-wrapper span.gnav-brand-title {
Expand Down
7 changes: 5 additions & 2 deletions libs/blocks/gnav/gnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {

const COMPANY_IMG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133.46 118.11"><defs><style>.cls-1{fill:#eb1000;}</style></defs><polygon class="cls-1" points="84.13 0 133.46 0 133.46 118.11 84.13 0"/><polygon class="cls-1" points="49.37 0 0 0 0 118.11 49.37 0"/><polygon class="cls-1" points="66.75 43.53 98.18 118.11 77.58 118.11 68.18 94.36 45.18 94.36 66.75 43.53"/></svg>';
const BRAND_IMG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 234"><defs><style>.cls-1{fill:#eb1000;}.cls-2{fill:#fff;}</style></defs><rect class="cls-1" width="240" height="234" rx="42.5"/><path id="_256" data-name="256" class="cls-2" d="M186.617,175.95037H158.11058a6.24325,6.24325,0,0,1-5.84652-3.76911L121.31715,99.82211a1.36371,1.36371,0,0,0-2.61145-.034l-19.286,45.94252A1.63479,1.63479,0,0,0,100.92626,148h21.1992a3.26957,3.26957,0,0,1,3.01052,1.99409l9.2814,20.65452a3.81249,3.81249,0,0,1-3.5078,5.30176H53.734a3.51828,3.51828,0,0,1-3.2129-4.90437L99.61068,54.14376A6.639,6.639,0,0,1,105.843,50h28.31354a6.6281,6.6281,0,0,1,6.23289,4.14376L189.81885,171.046A3.51717,3.51717,0,0,1,186.617,175.95037Z"/></svg>';
const BRAND_LOGO_AS_TEXT = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" viewBox="0 0 64.57 35"><defs><style>.cls-1{fill: #eb1000;}</style></defs><path class="cls-1" d="M6.27,10.22h4.39l6.2,14.94h-4.64l-3.92-9.92-2.59,6.51h3.08l1.23,3.41H0l6.27-14.94ZM22.03,13.32c.45,0,.94.04,1.43.16v-3.7h3.88v14.72c-.89.4-2.81.89-4.73.89-3.48,0-6.47-1.98-6.47-5.93s2.88-6.13,5.89-6.13ZM22.52,22.19c.36,0,.65-.07.94-.16v-5.42c-.29-.11-.58-.16-.96-.16-1.27,0-2.45.94-2.45,2.92s1.2,2.81,2.47,2.81ZM34.25,13.32c3.23,0,5.98,2.18,5.98,6.02s-2.74,6.02-5.98,6.02-6-2.18-6-6.02,2.72-6.02,6-6.02ZM34.25,22.13c1.11,0,2.14-.89,2.14-2.79s-1.03-2.79-2.14-2.79-2.12.89-2.12,2.79.96,2.79,2.12,2.79ZM41.16,9.78h3.9v3.7c.47-.09.96-.16,1.45-.16,3.03,0,5.84,1.98,5.84,5.86,0,4.1-2.99,6.18-6.53,6.18-1.52,0-3.46-.31-4.66-.87v-14.72ZM45.91,22.17c1.34,0,2.56-.96,2.56-2.94,0-1.85-1.2-2.72-2.5-2.72-.36,0-.65.04-.91.16v5.35c.22.09.51.16.85.16ZM58.97,13.32c2.92,0,5.6,1.87,5.6,5.64,0,.51-.02,1-.09,1.49h-7.27c.4,1.32,1.56,1.94,3.01,1.94,1.18,0,2.27-.29,3.5-.82v2.97c-1.14.58-2.5.82-3.9.82-3.7,0-6.58-2.23-6.58-6.02s2.61-6.02,5.73-6.02ZM60.93,18.02c-.2-1.27-1.05-1.78-1.92-1.78s-1.58.54-1.87,1.78h3.79Z"/></svg>';
const SEARCH_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false"><path d="M14 2A8 8 0 0 0 7.4 14.5L2.4 19.4a1.5 1.5 0 0 0 2.1 2.1L9.5 16.6A8 8 0 1 0 14 2Zm0 14.1A6.1 6.1 0 1 1 20.1 10 6.1 6.1 0 0 1 14 16.1Z"></path></svg>';
const SEARCH_DEBOUNCE_MS = 300;
export const IS_OPEN = 'is-open';
Expand Down Expand Up @@ -144,6 +145,7 @@ class Gnav {
decorateBrand = () => {
const brandBlock = this.body.querySelector('[class^="gnav-brand"]');
if (!brandBlock) return null;
const isBrandImage = brandBlock.matches('.brand-image-only');
const brandLinks = [...brandBlock.querySelectorAll('a')];
const brand = brandLinks.pop();
const brandTitle = brand.textContent;
Expand All @@ -157,10 +159,11 @@ class Gnav {
decorateSVG(brandLinks[0]);
brand.insertAdjacentElement('afterbegin', brandBlock.querySelector('img'));
} else {
brand.insertAdjacentHTML('afterbegin', BRAND_IMG);
const DEFAULT_IMAGE = isBrandImage ? BRAND_LOGO_AS_TEXT : BRAND_IMG;
brand.insertAdjacentHTML('afterbegin', DEFAULT_IMAGE);
}
}
brand.append(title);
if (!isBrandImage) brand.append(title);
return brand;
};

Expand Down

0 comments on commit 82bf330

Please sign in to comment.