{%- from "kerko/_attributes.html.jinja2" import title_aria_label %}

{%- macro expand_collapse_buttons(
            collapse_id,
            btn_class='btn btn-light btn-sm',
            expand_label=_("Show more"),
            expand_description='',
            expand_icon='fas fa-chevron-down',
            collapse_label=_("Show less"),
            collapse_description='',
            collapse_icon='fas fa-chevron-up',
            icons_width='',
            expand_default=False
        )
    -%}
    <button class="{{ [btn_class, 'btn-expand']|join(' ') }}" data-toggle="collapse" data-target="#{{ collapse_id }}" aria-controls="{{ collapse_id }}" aria-expanded="{% if expand_default %}true{% else %}false{% endif %}" {% if expand_description %}{{ title_aria_label(expand_description) }}{% endif %}>
        {%- if expand_icon %}<span class="{{ expand_icon }}" aria-hidden="true" {% if icons_width %}style="width: {{ icons_width }};"{% endif %}></span>{% endif -%}{% if expand_label %} {{ expand_label }}{% endif %}
    </button>{#- No whitespace -#}
    <button class="{{ [btn_class, 'btn-collapse']|join(' ') }}" data-toggle="collapse" data-target="#{{ collapse_id }}" aria-controls="{{ collapse_id }}" aria-expanded="{% if expand_default %}false{% else %}true{% endif %}" {% if collapse_description %}{{ title_aria_label(collapse_description) }}{% endif %}>
        {%- if collapse_icon %}<span class="{{ collapse_icon }}" aria-hidden="true" {% if icons_width %}style="width: {{ icons_width }};"{% endif %}></span>{% endif -%}{% if collapse_label %} {{ collapse_label }}{% endif %}
    </button>
{%- endmacro %}
