Skip to content

Commit

Permalink
Adds fixes based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoss-nc committed Dec 10, 2024
1 parent d25be4d commit 37d1bb1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 15 additions & 11 deletions blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -250,25 +250,29 @@ header {
> li {
font-size: var(--txt159-font-size);
line-height: var(--txt159-line-height);
font-weight: 400;

a:any-link {
--nav-section-link-active-color: transparent;

position: relative;
display: inline-flex;
flex-direction: column;
gap: 4px;
text-decoration: none;

&::after {
content: '';
display: block;
height: 2px;
margin-block-end: -2px;
background-color: var(--nav-section-link-active-color);
}

&.active,
&:hover,
&:focus-visible {
position: relative;
display: inline-flex;
flex-direction: column;
gap: 4px;

&::after {
content: '';
display: block;
height: 2px;
margin-block-end: -2px;
background-color: var(--col-brand30);
--nav-section-link-active-color: var(--col-brand30);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ function setActiveLink(links) {

links.forEach((link) => {
const navUrlObject = new URL(link.href);

// exclude external links
if (navUrlObject.origin !== window.location.origin) return;

const currentPathWithoutTrailingSlash = removeTrailingSlash(window.location.pathname);
const linkPathWithoutTrailingSlash = removeTrailingSlash(navUrlObject.pathname);

Expand Down

0 comments on commit 37d1bb1

Please sign in to comment.