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

Add file download icon to de-risking guide primary nav #728

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
7 changes: 5 additions & 2 deletions _includes/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
class="usa-nav__link{% if basedir == linkdir %} usa-current{% endif %}"
href="{{ nav_item.url | url }}"
{% if nav_item.download %}download{% endif %}
><span>{{ nav_item.name | escape }}</span></a
>
><span>{{ nav_item.name | escape }}</span>
{% if nav_item.download %}
<span class="download-icon">{% uswds_icon "file_download" %}</span>
{% endif %}
</a>
</li>
{% else %} {% assign nav_id = 'primary-nav-' | append: forloop.index %}
<li class="usa-nav__primary-item">
Expand Down
11 changes: 11 additions & 0 deletions assets/_common/styles/custom-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,14 @@ h2.heading-md {
vertical-align: middle;
}
}

/* Primary navigation icons */
.usa-nav__primary-item .usa-nav__link .download-icon {
padding-left: 2px;

.usa-icon {
min-height: 1rem;
min-width: 1rem;
vertical-align: middle;
}
}
6 changes: 6 additions & 0 deletions assets/_common/styles/overrides/extended-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@
border-style: solid;
border-top: 0;
}

/* Position the file download icon in the primary nav */
.usa-nav__primary-item .usa-nav__link span.download-icon .usa-icon {
display: inline-block;
margin-top: 1px;
}
}
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ agile:
url: /agile/
```

You can add the `download` attribute to a primary navigation link and specify a file name by setting the optional `download` key to `true`.
If you set the optional `download` key to `true` for a navigation item, it will add the `download` attribute to the link and display a file download icon next to its name.

_Example:_
```
Expand Down
Loading