{# LIBRARIES #}
{{ attach_library('ui_patterns/sa_travel_updates.sa_travel_updates_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 as_alerts = as_alerts|default(true) %}
{% if 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 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>',
          "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 -->
