{% set videos = _block.groupsVideos.all() ?? [] %}

{% set class = (videos|length) >= 3 ? 'col-md-4' : 'col-md-7 mx-auto' %}
{% if (videos|length) == 2 %}
  {% set class = 'col-md-6' %}
{% endif %}

{% if (videos|length) > 0 %}
  <section 
    class="gridVideos">
    <div class="container py-3">
      <section class="row g-3 pt-3">
        {% for item in videos %}
          <div class="col-12 {{
            class
            }} d-flex justify-content-center flex-column align-items-center">
     
            {% include 'components/_blockVideo' with {
              contentVideo: item,
              type: item.type,
              titleVideo: item.itemTitle
            } only %} 

            {% if (item.itemTitle|length) > 0 %} 
              <p class="gridVideos__titleVideo py-2">
                {{ item.itemTitle }}
              </p>
            {% endif %}
          </div>
        {% endfor %}
      </section>
    </div>
  </section>
{% endif %}