Files
notifications-admin/app/templates/components/pill.html
Tom Byers 9598d3a97b Change pills from tabs to navigation
Changes the HTML to do the following:
- remove all tabs semantics
- give the list a role of navigation
- label the navigation with the h1
- mark the selected item with aria-current
2020-09-04 09:02:36 +01:00

33 lines
1006 B
HTML

{% from 'components/big-number.html' import big_number %}
{% macro pill(
items=[],
current_value=None,
big_number_args={'smaller': True},
show_count=True
) %}
<nav aria-labelledby='page-header'>
<ul class='pill'>
{% for label, option, link, count in items %}
{% if current_value == option %}
<li>
<div class='pill-selected-item{% if not show_count %} pill-centered-item{% endif %}' tabindex='0' aria-current='page'>
{% else %}
<li>
<a class="govuk-link govuk-link--no-visited-state" href="{{ link }}">
{% endif %}
{% if show_count %}
{{ big_number(count, **big_number_args) }}
{% endif %}
<div class="pill-label{% if not show_count %} pill-centered-item{% endif %}">{{ label }}</div>
{% if current_value == option %}
</div>
{% else %}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{% endmacro %}