{# LIBRARIES #}
{{ attach_library('ui_patterns/tweet_carousel.tweet_carousel_lib') }}

{# VARIABLES #}
{% if items|length %}

  {% set slides = [] %}
  {% for item in items %}
    {% set slide_item %}
      <div class="tweet-slide">
        <div class="tweet-time">
          <i class="far fa-clock"></i>
          {{ item.timeago|raw }}
        </div>
        {{ item.text|raw }}
        {% if item.entities.urls[0] %}
          {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
            "text": item.entities.urls[0].expanded_url,
            "url": item.entities.urls[0].url,
            "icon_right": "fas fa-external-link-square-alt",
            "class": link_class
          } only %}
        {% endif %}
      </div>
    {% endset %}
    {% set slides = slides|merge([{'slide':slide_item}]) %}
  {% endfor %}

  {# TEMPLATE #}
  <div class="lvup h-100 mb-3">
    <div class="row h-100">
      <div class="col-2 lvup-icon text-center">
        <i class="fab fa-twitter"></i>
      </div>
      <div class="col-10 h-100 lvup-body">
        {{ pattern('bs_carousel', {
          'pid': 'twitter',
          'slides': slides,
          'data_ride': 'false',
          'show_indicators': false,
          'show_controls': true,
        }) }}
      </div>
    </div>
  </div>

{% endif %}
