{% load wagtailimages_tags banner_tags %}

{% get_banners banner_key as banners %}
{% if banners %}
  <div class="banner-snippets">
    {% for banner in banners %}
      <div class="banner-snippets__item">
        {% if banner.link_url %}
          <a class="banner-snippets__link" href="{{ banner.link_url }}">
            {% image banner.image fill-1200x300 alt=banner.title %}
            {% if banner.title %}
              <span class="banner-snippets__title">{{ banner.title }}</span>
            {% endif %}
            {% if banner.link_text %}
              <span class="banner-snippets__cta">{{ banner.link_text }}</span>
            {% endif %}
          </a>
        {% else %}
          {% image banner.image fill-1200x300 alt=banner.title %}
          {% if banner.title %}
            <span class="banner-snippets__title">{{ banner.title }}</span>
          {% endif %}
        {% endif %}
      </div>
    {% endfor %}
  </div>
{% endif %}
