{#
  Template for UnLondon card.

  image: the image.
  url: the url to link to.
  title: the card title.
  text: the card text.
  layout: the image layout, one of:
    overlay
    stacked
#}

{{ attach_library('ui_patterns/ul_card.ul_card_lib') }}

{% set layout = layout|default('overlay') %}
{% if text or image or title %}
  <a class="ul-card {{ layout }} {{ aspect_ratio }}{% if layout == 'stacked' %} cbelianr{% endif %}" href="{{ url }}">
    {{ image }}
    <div class="ul-card-{% if layout == 'overlay' %}overlay{% else %}text{% endif %}">
    {% if layout == 'overlay' %}
      <h3 class="ul-title{% if not text %} m-0{% endif %}">{{ title }}</h3>
    {% else %}
      {% set class = 'ul-title' %}
      {% if not text %}
        {% set class = class ~ ' m-0' %}
      {% endif %}
      {% include '@atoms/tm-links/icon-bookended/icon-bookended.twig' with {
        "text": title,
        "icon_right": global_icon_right|default('fas fa-chevron-right'),
        "class": class,
        "tag_name": "h3",
      } only %}
    {% endif %}
    {% if text %}
      <p>{{ text }}</p>
    {% endif %}
    </div>
  </a>
{% endif %}
