Skip to content

Commit

Permalink
Modified FAQ Nav (#139)
Browse files Browse the repository at this point in the history
Co-authored-by: Mathieu Lessard <[email protected]>
  • Loading branch information
mathieu-lessard and Mathieu Lessard authored Jul 16, 2024
1 parent bd7b9a9 commit a668e8a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
10 changes: 10 additions & 0 deletions blocks/adp-header/adp-header.css
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ header nav .nav-bottom {
width: 100%;
}

header.hide-navigation-tabs nav .nav-bottom {
display: none;
}

header nav {
display: grid;
grid-template-areas:
Expand All @@ -526,6 +530,12 @@ header nav {
box-shadow: 0 0 4px rgba(233 233 233 / 100%);
}

header.hide-navigation-tabs nav {
grid-template-areas:
"nav-top";
grid-template-rows: calc(var(--nav-height) - var(--header-banner-height));
}

.contenthub header nav {
background: var(--contenthub-header-background);
border-bottom: unset;
Expand Down
6 changes: 3 additions & 3 deletions blocks/adp-header/adp-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ function toggleMenu(nav, navSections, forceExpanded = null) {
*/
export default async function decorate(block) {
block.textContent = '';

const logoUrl = document.querySelector('head meta[name="logo-link"]')?.getAttribute('content');
// decorate nav DOM
const nav = document.createElement('nav');
nav.id = 'nav';
nav.innerHTML = `
<div class="nav-top">
<div class="nav-brand">
<a class="adp-logo" href="${getBaseConfigPath()}/"></a>
<a class="adp-logo" href="${logoUrl ?? getBaseConfigPath()}/"></a>
<div></div>
</div>
<div class="nav-sections">
Expand Down Expand Up @@ -224,7 +224,7 @@ export default async function decorate(block) {
}

if (await getUserProfile() !== null) {
document.querySelector('.adp-logo').href = getBaseConfigPath() + '/assets';
document.querySelector('.adp-logo').href = logoUrl ?? (getBaseConfigPath() + '/assets');
loadSearchField(nav);
if (!window.unifiedShellRuntime) {
await createUserInfo(nav);
Expand Down
3 changes: 3 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ async function loadLazy(doc) {
}
if (!(document.querySelector('head meta[name="hide-header"]')?.getAttribute('content') === 'true')) {
loadHeader(doc.querySelector('header'), 'adp-header');
if(document.querySelector('head meta[name="hide-navigation-tabs"]')?.getAttribute('content') === 'true'){
doc.querySelector('header').classList.add('hide-navigation-tabs');
}
} else {
document.querySelector('header').classList.add('hidden');
}
Expand Down
4 changes: 4 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ header.hidden {
display: none;
}

header.hide-navigation-tabs{
height: 30px;
}

h1,
h2,
h3,
Expand Down

0 comments on commit a668e8a

Please sign in to comment.