{% assign events_counter = 0 %}
<div class="heading-container">
  <a href='/app/training_events' class="carousel-heading events-link">
    Upcoming Events
  </a>
</div>
<div class="carousel-wrapper">
  <div class="events-carousel">
      {% for training_event in training_events.enrolled %}
        <div class="event-cart-carousel-item">
          {% include "cards_training_event" with training_event %}
          {% assign events_counter = events_counter |  plus: 1 %}
        </div>
      {% endfor %}
  </div>
  {% if events_counter == 0 %}
    {% include "training_events_zero_state" %}
  {% endif %}
</div>  
<style>
  .events-grid-container {
    width: 33%;
  }
  .events-carousel {
    width: 100%;
    margin: 0;
  }
  .events-link {
    text-decoration: none;
  }
</style>

<script>
$(document).ready(function() {

    $(".events-carousel").slick({
        slidesToShow: 1,
        cssEase: 'linear',
        prevArrow: '<i class="fal fa-chevron-left arrow-left"></i>',
        nextArrow: '<i class="fal fa-chevron-right arrow-right"></i>',
        infinite: false,
        responsive: [
            {
                breakpoint: 1170,
                settings: {
                    slidesToShow: 1,
                }
            },
            {
                breakpoint: 768,
                settings: {
                    slidesToShow: 1,
                    slidesToScroll: 1,
                    dots: false,
                    arrows: true,
                }
            }
        ]
    });
});
</script>