{% extends "node--featured--sky.html.twig" %}

{% block card_title %}

  <div class="teaser__header">

    {{ title_prefix.teaser_tag }}

    {% if visibility_icon and visibility_label %}
      <div class="badge teaser__badge no-padding">
        <span class="badge__container">
          <svg class="badge__icon">
            <title>{% trans %}Visibility: {% endtrans %}</title>
            <use xlink:href="#icon-{{ visibility_icon }}"></use>
          </svg>
          <span class="badge__label text-gray">{{ visibility_label|capitalize }}</span>
        </span>
      </div>
    {% endif %}
  </div>

  {{ title_prefix|without('teaser_tag') }}
  <h4{{ title_attributes }} class="teaser__title">
    <a href="{{ url }}" rel="bookmark">{{ label }}</a>
  </h4>
  {{ title_suffix }}

{% endblock %}

{% block card_body %}
  <small class="text-muted">

    {% embed "node--teaser__field.html.twig" %}
      {%- block field_icon -%} schedule {%- endblock -%}
      {%- block svg_title -%} <title> {% trans %}Event schedule{% endtrans %} </title> {%- endblock -%}
      {%- block field_value %}
        <span class="sr-only">{% trans %}Event date{% endtrans %} </span>
        {{ event_date }}
      {%- endblock -%}
    {% endembed %}

    {% if content.field_event_location|render %}
      {% embed "node--teaser__field.html.twig" %}
        {%- block field_icon -%} location {%- endblock -%}
        {%- block svg_title -%} <title> {% trans %}Event location{% endtrans %} </title> {%- endblock -%}
        {%- block field_value -%}
          <span class="sr-only">{% trans %}The event will take place at the{% endtrans %} </span>
          {{ content.field_event_location }}
        {%- endblock -%}
      {% endembed %}
    {% endif %}

    {% if content.ongoing %}
      <span class="badge badge-primary teaser__badge">
          {{ content.ongoing }}
        </span>
    {% endif %}
    {% if content.enrolled %}
      <span class="badge badge-default teaser__badge">
        {{ content.enrolled }}
      </span>
    {% endif %}

  </small>
{% endblock %}

{% block card_actionbar %}

  {% if comment_count %}
    <a href="{{ url }}#section-comments" class="badge teaser__badge" title="{% trans %}Total amount of comments{% endtrans %}">
      <span class="badge__container">
        <svg class="badge__icon" aria-hidden="true">
          <title>{% trans %}Total amount of comments{% endtrans %}</title>
          <use xlink:href="#icon-comment"></use>
        </svg>
        <span class="badge__label">{{ comment_count }}</span>
      </span>
    </a>
  {% endif %}

  {% if content.enrollments_count is not empty %}
    <div class="badge teaser__badge">
      <span class="badge__container">
        <svg class="badge__icon">
          <title>{% trans %}Total amount of enrollments{% endtrans %}</title>
          <use xlink:href="#icon-person"></use>
        </svg>
        <span class="badge__label">
          {{ content.enrollments_count }}
        </span>
      </span>
    </div>
  {% endif %}

  {% block card_link %}
    {% if not hide_card_link %}
      <div class="card__link">
        <a href="{{ url }}" rel="bookmark">{{ 'Read more'|t }}
          <span class="visually-hidden">{% trans %}about {{ label }}{% endtrans %} </span>
        </a>
      </div>
    {% endif %}
  {% endblock %}

{% endblock %}
