Skip to content

Commit

Permalink
Fixed logic to hide header
Browse files Browse the repository at this point in the history
- [x] tested when glossary is not enabled
- [x] tested when glossary is enabled with summary box
- [x] updated glossary.html to set header class for tagetting to hide in
  summary-box.js
- [x] set conditional to hide/display glossary.html partial based on
  glossary field set in parent _index.md
  • Loading branch information
nick-mon1 committed Mar 1, 2024
1 parent 24d20a4 commit f69c7cd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
4 changes: 3 additions & 1 deletion themes/digital.gov/layouts/guides/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
{{- else -}}
{{- partial "core/guides/guide-content.html" . -}}
{{- end -}}
{{- partial "core/glossary.html" . -}}
{{- if .Parent.Params.glossary -}}
{{- partial "core/glossary.html" . -}}
{{- end -}}
</article>
</main>
{{ end }}
5 changes: 3 additions & 2 deletions themes/digital.gov/layouts/landings/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ <h1>{{- .Params.title -}}</h1>
</a>
</div>
</header>

<article class="dg-landing__body grid-container grid-container-desktop">
<div>
{{- .Content -}}
Expand Down Expand Up @@ -46,6 +45,8 @@ <h2 class="usa-card__heading">
{{- end -}}
{{- partial "core/attribution.html" . -}}
</article>
{{- partial "core/glossary.html" . -}}
{{- if .Parent.Params.glossary -}}
{{- partial "core/glossary.html" . -}}
{{- end -}}
</main>
{{ end }}
56 changes: 26 additions & 30 deletions themes/digital.gov/layouts/partials/core/glossary.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
{{ if ne .Params.glossary nil }}
<aside
class="dg-glossary__container"
aria-describedby="dg-glossary__result"
aria-hidden="true"
>
<button title="Close glossary" class="dg-glossary__close" disabled>
<svg
class="usa-icon dg-icon dg-icon--large"
aria-hidden="true"
focusable="true"
>
<use xlink:href="{{ "/uswds/img/sprite.svg#close" | relURL }}"></use>
</svg>
</button>

<h2>Glossary</h2>
<label for="dg-glossary__search" class="usa-label"
>Search for a term:</label
<aside
class="dg-glossary__container"
aria-describedby="dg-glossary__result"
aria-hidden="true"
>
<button title="Close glossary" class="dg-glossary__close" disabled>
<svg
class="usa-icon dg-icon dg-icon--large"
aria-hidden="true"
focusable="true"
>
<input
id="dg-glossary__search"
class="dg-glossary__search usa-input"
type="text"
disabled
/>
<div class="dg-glossary__content" id="dg-glossary__result">
<ul class="dg-glossary__list add-list-reset"></ul>
</div>
</aside>
{{ end }}
<use xlink:href="{{ "/uswds/img/sprite.svg#close" | relURL }}"></use>
</svg>
</button>

<h2 class="dg-glossary__header">Glossary</h2>
<label for="dg-glossary__search" class="usa-label">Search for a term:</label>
<input
id="dg-glossary__search"
class="dg-glossary__search usa-input"
type="text"
disabled
/>
<div class="dg-glossary__content" id="dg-glossary__result">
<ul class="dg-glossary__list add-list-reset"></ul>
</div>
</aside>
2 changes: 1 addition & 1 deletion themes/digital.gov/src/js/summary-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const guideSummaryList = guideSummary.querySelector(".usa-list");
const pageHeaders = document.querySelectorAll(
"h2:not(.usa-summary-box__heading, .dg-guide__content-header-title)"
"h2:not(.usa-summary-box__heading, .dg-guide__content-header-title, .dg-glossary__header)"
);

function createSummaryBox() {
Expand Down

0 comments on commit f69c7cd

Please sign in to comment.