{# LIBRARIES #}
{{ attach_library('ui_patterns/libraries.bs_collapse') }}
{{ attach_library('ui_patterns/sa_lb_section.sa_lb_section_lib') }}

{# LIBRARIES #}
{% set title = title|default("Important information") %}
{% set link_icon_left = link_icon_left|default('fas fa-exclamation-triangle') %}
{% set link_icon_right = link_icon_right|default('fas fa-chevron-right') %}
{% set dismiss = dismess|default("Dismiss") %}
{% set hide_dismiss = hide_dismiss|default(false) %}

{# TEMPLATE #}
{% if links %}
  <div id="sa-lb-section" class="{% if not hide_dismiss %}collapse show{% endif %} row">

    <h2 class="col-sm-6">{{ title }}</h2>

    <div class="col-sm-6">
      {% if not hide_dismiss %}
        {% set dismiss_attr = create_attribute()
          .setAttribute('id', 'sa-lb-section-dismiss')
          .setAttribute('data-bs-toggle', 'collapse')
          .setAttribute('data-bs-target', "#sa-lb-section")
          .setAttribute('aria-expanded', 'true')
        %}
        {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
          "text": "Dismiss",
          "attr": dismiss_attr,
          "class": "belianu dismiss fr",
          "url": "#sa-lb-section",
          "icon_right": "fas fa-chevron-up",
        } only %}
      {% endif %}
    </div>

    <!-- Link items -->
    {% for link in links %}
      <div class="col-md-6 col-sm-6">
        {% include "@organisms/tm-sa/sa-block-top/sa-block-top.twig" with {
          "text": link['text'],
          "url": link['url'],
          "extra": link['extra'],
          "intro": link['intro'],
          "block_status": link['block_status'],
          "icon_right": link_icon_right,
          "icon_left": link_icon_left,
        } only %}
      </div>
    {% endfor %}
    <!-- / Link items -->

  </div>
{% endif %}
