-
Notifications
You must be signed in to change notification settings - Fork 114
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
Secondary Nav: refactor into new design #8011
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ab1f3f5
Refactor breadcrumb and secondary nav
anselmbradford 99ecdef
Add translations for Navigate this Section
anselmbradford 3e51d43
Adjust opacity
anselmbradford b5f354e
Remove conditionals around slash
anselmbradford 6ea1b8c
Remove second divider
anselmbradford 4aaa017
Change secondary nav icons
anselmbradford 089d05a
Restyle regs
anselmbradford 97dc04d
Merge branch 'main' into ans_breadcrumb_nav_beta_demo4
anselmbradford File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,50 @@ | ||
{# ========================================================================== | ||
|
||
breadcrumbs.render() | ||
breadcrumbs.render() | ||
|
||
========================================================================== | ||
========================================================================== | ||
|
||
Description: | ||
Description: | ||
|
||
Create breadcrumb markup when given: | ||
Create breadcrumb markup when given: | ||
|
||
breadcrumbs: An array of tuples used to display nav items. | ||
Format: (href, live, title) | ||
breadcrumbs: An array of tuples used to display nav items. | ||
Format: (href, live, title) | ||
|
||
========================================================================== #} | ||
========================================================================== #} | ||
|
||
{% macro render( breadcrumbs ) %} | ||
<nav class="m-breadcrumbs" aria-label="{{ _('Breadcrumbs') }}"> | ||
|
||
{# Change slash direction in RTL languages. #} | ||
{% if language == 'ar' %} | ||
{% set crumb_divider = ' \\ ' %} | ||
{% else %} | ||
{% set crumb_divider = ' / ' %} | ||
{% endif %} | ||
|
||
{% for crumb in breadcrumbs %} | ||
|
||
{% if loop.index == loop.length %} | ||
{{ crumb_divider }} | ||
{% endif %} | ||
|
||
{% macro render( breadcrumbs ) %} | ||
<nav class="breadcrumbs" aria-label="{{ _('Breadcrumbs') }}"> | ||
{{ svg_icon('left') }} | ||
{% for crumb in breadcrumbs %} | ||
{% if crumb.href or crumb.live %} | ||
<a href="{{ crumb.href if crumb.href else pageurl(crumb) }}"> | ||
{{ crumb.title | e }} | ||
<a class="m-breadcrumbs_crumb" | ||
href="{{ crumb.href if crumb.href else pageurl(crumb) }}"> | ||
{{ crumb.title }} | ||
</a> | ||
{% else %} | ||
<span class="breadcrumbs_text">{{ crumb.title | e }}</span> | ||
<span class="m-breadcrumbs_crumb"> | ||
{{ crumb.title }} | ||
</span> | ||
{% endif %} | ||
{% if not loop.last %} | ||
{% if language == 'ar' %} | ||
\ | ||
{% else %} | ||
/ | ||
{% endif %} | ||
|
||
{% if loop.index < loop.length - 1 %} | ||
{{ crumb_divider }} | ||
{% endif %} | ||
{% endfor %} | ||
</nav> | ||
{% endmacro %} | ||
|
||
|
||
{% endfor %} | ||
</nav> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anselmbradford in response to your question about the leading slash: in Jinja
for
syntax theloop.index
variable is 1-based, not 0-based. So if the length of the breadcrumbs is 1, this will render the divider the first time through the loop. See docs here, you can useloop.index0
instead.I'm a bit unclear from your comments above with @jenn-franklin -- what is the desired behavior? If you don't want to render the slash if there's only one parent breadcrumb, you could remove this clause, but will it be obvious that this is a breadcrumb then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't include the first slash during usability testing, and participants didn't struggle to understand that it was a breadcrumb, so that's good! But... ugh... I'm waffling. Haha. I guess ultimately I may lean a little more toward including the first slash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is, http://localhost:8000/es/herramientas-del-consumidor/prestamos-para-vehiculos/respuestas/conozca-sus-derechos/ would not have a leading slash, while http://localhost:8000/es/coronavirus/maneje-sus-finanzas/ would. I guess we either always want the slash or always not have it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah, I'd say always slash or never slash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's helpful, Jinja has a
random
filter if we want to show slashes to some visitors but not others. Keep the cf.gov experience dynamic and interesting!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with slash!