{#
/**
 * @file
 * Default theme implementation for a cell of a Calendar View table.
 *
 * Available variables:
 * - elements: Original variables passed to this template.
 * - attributes: HTML attributes for the wrapper.
 * - timestamp: The datetime value.
 * - empty: Wether or not this day as content.
 * - content: Custom content.
 * - rows: A list of view rows including the following:
 *   - content: The content as a render array.
 *   - attributes: The date field name used to get this content.
 *
 * @see template_preprocess_calendar_view_day()
 *
 * @ingroup themeable
 */
#}
{%
  set classes = [
    'calendar-view-day',
    empty ? 'empty',
  ]
%}

<div{{ attributes.addClass(classes) }}>
  {% set html_date = timestamp|format_date('html_date') %}
  {% set count = (not rows ? 0 : rows|length)|number_format %}
  {% set day_title %}
    {% trans %}
      {{ count }} result for {{ html_date }}
    {% plural count %}
      {{ count }} results for {{ html_date }}
    {% endtrans %}
  {% endset %}

	{# The day #}
	{% block day_number %}
    <time class="calendar-view-day__number" datetime="{{ timestamp|date('Y-m-d\TH:i:s') }}" title="{{ day_title|trim }}">
      {{ timestamp|date('j') }}
    </time>
	{% endblock %}

  {% block day_content %}
    {% if count < 1 %}
      {# Empty #}
      <div class="calendar-view-day__rows empty"></div>
    {% else %}
      {# Events #}
      <ul class="calendar-view-day__rows">
        {% for row in rows %}
          {% set row_classes = [default_row_class ? 'views-row'] %}
          <li{{ row.attributes.addClass(row_classes,'calendar-view-day__row') }}>
            {{- row.content -}}
          </li>
        {% endfor %}
      </ul>
    {% endif %}
  {% endblock %}
</div>
