2016-06-08 15:15:59 +01:00
|
|
|
{% from 'components/big-number.html' import big_number %}
|
|
|
|
|
|
2016-04-13 12:50:28 +01:00
|
|
|
{% macro pill(
|
|
|
|
|
items=[],
|
2017-01-25 15:59:06 +00:00
|
|
|
current_value=None,
|
2017-06-13 15:28:33 +01:00
|
|
|
big_number_args={'smaller': True},
|
|
|
|
|
show_count=True
|
2016-04-13 12:50:28 +01:00
|
|
|
) %}
|
2017-02-14 14:21:36 +00:00
|
|
|
<ul role='tablist' class='pill'>
|
2016-06-08 15:15:59 +01:00
|
|
|
{% for label, option, link, count in items %}
|
2016-04-13 12:50:28 +01:00
|
|
|
{% if current_value == option %}
|
2017-02-14 14:21:36 +00:00
|
|
|
<li aria-selected='true' role='tab'>
|
2017-06-23 10:53:24 +01:00
|
|
|
<div class='pill-selected-item{% if not show_count %} pill-centered-item{% endif %}' tabindex='0'>
|
2016-04-13 12:50:28 +01:00
|
|
|
{% else %}
|
2017-02-14 14:21:36 +00:00
|
|
|
<li aria-selected='false' role='tab'>
|
|
|
|
|
<a href="{{ link }}">
|
2016-06-08 15:15:59 +01:00
|
|
|
{% endif %}
|
2017-06-13 15:28:33 +01:00
|
|
|
{% if show_count %}
|
2017-02-14 15:09:54 +00:00
|
|
|
{{ big_number(count, **big_number_args) }}
|
2017-06-13 15:28:33 +01:00
|
|
|
{% endif %}
|
2017-06-23 10:53:24 +01:00
|
|
|
<div class="pill-label{% if not show_count %} pill-centered-item{% endif %}">{{ label }}</div>
|
2016-06-08 15:15:59 +01:00
|
|
|
{% if current_value == option %}
|
2017-02-14 15:09:54 +00:00
|
|
|
</div>
|
2016-06-08 15:15:59 +01:00
|
|
|
{% else %}
|
2017-02-14 14:21:36 +00:00
|
|
|
</a>
|
2016-04-13 12:50:28 +01:00
|
|
|
{% endif %}
|
2017-02-14 14:21:36 +00:00
|
|
|
</li>
|
2016-04-13 12:50:28 +01:00
|
|
|
{% endfor %}
|
2017-02-14 14:21:36 +00:00
|
|
|
</ul>
|
2016-06-08 15:15:59 +01:00
|
|
|
{% endmacro %}
|