Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demote headings on index, but retain styling #4065

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion _includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
{% for item in nav %}
<li>
{% if item.children %}
<h{{ level }} id="{{ item.text | slugify }}">
{% if viz-promote %}
{% assign cssLevel = level | minus: 1 %}
{% assign cssClass = "handbook-visual-h" | append: cssLevel %}
{% endif %}
<h{{ level }} id="{{ item.text | slugify }}" class="{{ cssClass }}">
{% include "nav-link.html" child:item %}
</h{{ level }}>
{% if item.blurb %}
Expand Down
2 changes: 1 addition & 1 deletion pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ <h2 class="font-heading-xl margin-top-0 tablet:margin-bottom-0">
</section>
<div class="layout-table-of-contents">
<div class="wrapper usa-prose">
{% render "nav.html", level:1 nav:navigation.primary %}
{% render "nav.html", level:2 nav:navigation.primary viz-promote:true %}
</div>
</div>
13 changes: 8 additions & 5 deletions styles/custom/toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
margin-bottom: units(2);
}

h1 {
h1,
h2.handbook-visual-h1 {
@include u-font("heading", "xl");
font-weight: fw("bold");
padding-top: units(3);
Expand All @@ -29,14 +30,16 @@
margin-top: 0;
}

h2 {
h2,
h3.handbook-visual-h2 {
@include u-font("heading", "lg");
font-weight: fw("bold");
margin-top: units(4);
color: color("blue-60");
}

h3 {
h3,
h4.handbook-visual-h3 {
@include typeset("heading", "md", 3);
font-weight: fw("bold");
margin: 0 0 units(0.5);
Expand All @@ -63,7 +66,7 @@
}

// third-level nav
h2 + ol {
h3 + ol {
@include at-media("tablet") {
column-count: 2;

Expand All @@ -75,7 +78,7 @@
}

// fourth-level nav
h3 + ol {
h4 + ol {
margin: units(1) 0 units(3) 0;

// fifth+ level nav
Expand Down
Loading