Skip to content

Commit

Permalink
Merge pull request #7727 from GSA/tc-fix-ring-shortcode
Browse files Browse the repository at this point in the history
Remove ring header from in-page-nav, fix style bug for h2
  • Loading branch information
afeijoo authored Jul 15, 2024
2 parents 4375f5f + 2b57a82 commit 6439f46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions themes/digital.gov/src/js/in-page-navigation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Only show the in-page navigation when 3 or more nav items are present on the page
// Only display h2's as the primary nav items and set h3 and h4 sub-items to display: none

document.addEventListener("DOMContentLoaded", () => {
const relatedItems = document.querySelector("[data-related-items]");
const inPageNav = document.querySelector(".usa-in-page-nav__nav");
Expand All @@ -17,4 +20,15 @@ document.addEventListener("DOMContentLoaded", () => {

inPageNavHeader.removeAttribute("tabindex");
relatedItems.before(inPageNav);

// Hide nav links when they are a child of a ring component
navItems.forEach((item) => {
const targetId = item.querySelector("a").getAttribute("href").slice(1);
const targetElement = document.getElementById(targetId);

if (targetElement && targetElement.closest(".dg-ring")) {
const newItem = item;
newItem.style.display = "none";
}
});
});
3 changes: 2 additions & 1 deletion themes/digital.gov/src/scss/new/shortcodes/_ring.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
position: relative;

&__title {
$font-size: units(3);
$font-size: units(4);

background: color("white");
font-size: $font-size;
Expand All @@ -23,6 +23,7 @@

h2 {
@include u-font("sans", "lg");
font-size: size("sans", 11);
font-weight: font-weight("semibold");
}
}

0 comments on commit 6439f46

Please sign in to comment.