Skip to content

Commit

Permalink
Merge branch 'main' into sign_megalinter_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
wesley-dean-gsa authored Aug 26, 2024
2 parents 091cb54 + ac36cbc commit 48fe727
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 12 deletions.
1 change: 1 addition & 0 deletions _img/minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _img/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

<div class="grid-col-auto">
<a class="usa-social-link" href="https://twitter.com/GSA_TTS"
>{% image_with_class "_img/twitter.svg" "Twitter" %}</a>
>{% image_with_class "_img/twitter.svg" "" "Twitter" %}</a>
</div>

<div class="grid-col-auto">
<a class="usa-social-link" href="https://www.linkedin.com/company/gsa-tts"
>{% image_with_class "_img/linkedin.svg" "LinkedIn" %}</a>
>{% image_with_class "_img/linkedin.svg" "" "LinkedIn" %}</a>
</div>

</div>
Expand Down
8 changes: 1 addition & 7 deletions _includes/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
{{ content }}

{% include "footer.html" %}

{% comment %} Hide SVG Sprites {% endcomment %}
<div style="display: none;">
{% usa_icons_sprite %}
{% uswds_icons_sprite %}
</div>


{% include "scripts.html" %}
</body>

Expand Down
2 changes: 1 addition & 1 deletion _includes/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
name="search"
/>
<button class="usa-button" type="submit">
{% image_with_class "_img/search--white.svg" "usa-search__submit-icon" %}
{% image_with_class "_img/search--white.svg" "usa-search__submit-icon" "Search" %}
</button>
</form>
</section>
Expand Down
28 changes: 28 additions & 0 deletions _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,31 @@
<script async src="https://search.usa.gov/javascripts/remote.loader.js" type="text/javascript"></script>
{% endif %}
{% endif %}

<!-- Custom subnav toggle -->
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggle = document.querySelector('.usa-subnav-mobile-toggle');
if (toggle) {
toggle.addEventListener('click', function() {
toggle.classList.toggle('open-subnav');
});
}

if (window.innerWidth < 1024) {
const sidenavItems = document.querySelectorAll('li.usa-sidenav__item');
sidenavItems.forEach(function(item) {
if (item.querySelector('ul')) {
item.classList.add('toggle-submenu');
}
});
}

const subtoggle = document.querySelectorAll('.toggle-submenu');
subtoggle.forEach(function(toggle) {
toggle.addEventListener('click', function() {
toggle.classList.toggle('open-subnav');
});
});
});
</script>
4 changes: 2 additions & 2 deletions _includes/search-gov.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
name="search"
/>
<button class="usa-button" type="submit">
{% image_with_class "_img/search--white.svg" "usa-search__submit-icon" %}
{% image_with_class "_img/search--white.svg" "usa-search__submit-icon" "Search" %}
</button>
</form>
</section>
</section>
1 change: 1 addition & 0 deletions _includes/sidenav.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<button class="usa-subnav-mobile-toggle">Jump to section</button>
<nav aria-label="Secondary navigation">
<ul class="usa-sidenav">
{% for link in links %}
Expand Down
107 changes: 107 additions & 0 deletions styles/tts-custom-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,110 @@ h5 {
.usa-prose .usa-card:last-child {
margin-bottom: 1rem;
}

.usa-subnav-mobile-toggle {
display: none;
}

/* Page sidenav */
@media only screen and ( max-width: 1024px ) {
.usa-layout-docs main.display-flex {
flex-wrap: wrap;
}

.usa-layout-docs__main {
flex: 0 0 100%;
padding: 3rem;
order: 2;
}

.usa-layout-docs__sidenav {
flex: 0 0 100%;
order: 1;
padding: 0rem 3rem;

nav {
opacity: 0;
height: 0;
transition: all .3s ease-in-out;
}

.usa-subnav-mobile-toggle {
display: flex;
border: none;
background: transparent;
font-weight: 600;
font-size: 1.25rem;
gap: 8px;
align-items: center;
line-height: 1;

&::after {
content: url('../_img/plus.svg');
display: block;
height: 16px;
width: 16px;
}

&.open-subnav {
margin-bottom: .75rem;

&::after {
content: url('../_img/minus.svg');
}

+ nav {
opacity: 1;
height: auto;
transition: all .3s ease-in-out;
}
}
}

.toggle-submenu {
position: relative;

&::before {
content: url('../_img/plus.svg');
position: absolute;
width: 16px;
height: 16px;
top: 9px;
right: 16px;
}

a {
width: fit-content;
}

ul {
opacity: 0;
height: 0;
transition: all .3s ease-in-out;
}

&.open-subnav {
&::before {
content: url('../_img/minus.svg');
}

ul {
opacity: 1;
height: auto;
transition: all .3s ease-in-out;
}
}
}

}
}

@media only screen and ( max-width: 768px ) {
.usa-layout-docs__main {
padding: 1rem;
}

.usa-layout-docs__sidenav {
padding: 0rem 1rem 2rem;
}
}

0 comments on commit 48fe727

Please sign in to comment.