{# LIBRARIES #}
{{ attach_library('ui_patterns/sa_travel_updates.sa_travel_updates_lib') }}
{{ attach_library('ui_patterns/libraries.bs_alert') }}
{{ attach_library('ui_patterns/alerts.alerts_lib') }}

{# VARIABLES #}
{% set block_classes = block_classes|default('mt-4') %}
{% set icon_left = icon_left|default('fas fa-exclamation-triangle') %}
{% set icon_right = icon_right|default(global_icon_right|default('fas fa-chevron-right')) %}
{% set not_as_alerts = not_as_alerts|default(false) %}
{% if not not_as_alerts %}
  {% set block_classes = block_classes ~ ' aa' %}
{% endif %}

{# TEMPLATE #}
<!-- Service announcements block -->
{% if links %}
  <div id="sa-block" class="{{ block_classes }}">
    {% for link in links %}
      {% if not not_as_alerts %}
        {% set content %}
          {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
            "text": link['text'],
            "url": link['url'],
            "icon_right": icon_right,
          } only %}
        {% endset %}
        {% include "@molecules/tm-message/alert/alert.twig" with {
          "content": content,
          "icon": '<i class="far fa-info-circle"></i>',
          "item_layout": 'side_icon'
        } only %}
      {% else %}
        {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
          "text": link['text'],
          "url": link['url'],
          "icon_left": icon_left,
          "icon_right": icon_right,
          "class": "sa-link belianr ffl"
        } %}
      {% endif %}
    {% endfor %}
  </div>
{% endif %}
<!-- / Service announcements block -->
