<div class="np-homepage-quicklearn np-max-width">
  <div class="np-homepage-quicklearn-text">
    <div class="np-homepage-headline">
      Quick Learn
    </div>
    <div class="quicklearn-carousel-controls np-hidden-mobile">
      <div class="prev-arrow carousel-control"><i class="far fa-chevron-left"></i></div>
      <div class="next-arrow carousel-control"><i class="far fa-chevron-right"></i></div>
    </div>
  </div>
  {% if items.size > 0 %}
    {% assign quicklearn_courses_count = 0 %}
    <div class="quicklearn-courses-wrapper">
      <div class="quicklearn-courses-slider">
        {% for course in items %}
          {% for cat in course.categories %}
            {% if cat.name == "Quick Learn" %}
              {% assign quicklearn_courses_count = quicklearn_courses_count | plus: 1 %}
              <div class="feature-course-slide">
                {% include "cards_course_banner" with course %}
              </div>
            {% endif %}  
          {% endfor %}  
        {% endfor %}
      </div>
    </div>

    {% if quicklearn_courses_count > 0 %}
      <div class="quicklearn-see-more-wrapper">
        <a href="/app/dashboard">See more</a>
      </div>
    {% else %}
      <script>console.log("{{quicklearn_courses_count}}")</script>
      <div class="np-homepage-quicklearnd-empty">
        <div class="np-zero-state-text">
          Sorry! You don't have any quick learn training at this moment.
        </div>
        <img class="np-zero-state-courses" alt="Sorry! You don't have any quick learn training at this moment." />
        <div class="zero-state-cta" style="margin-top:32px;">
          <a href="/app/catalog" class="np-button">Explore Catalog</a>
        </div>
      </div>
    {% endif %}
  {% else %}
    <div class="np-homepage-quicklearnd-empty">
      <div class="np-zero-state-text">
        Sorry! You don't have any quick learn training at this moment.
      </div>
      <img class="np-zero-state-courses" alt="Sorry! You don't have any quick learn training at this moment." />
      <div class="zero-state-cta" style="margin-top:32px;">
        <a href="/app/catalog" class="np-button">Explore Catalog</a>
      </div>
    </div>
  {% endif %}
</div>


<script>

  window.addEventListener("DOMContentLoaded", (event) => {

    var quicklearnSlider = tns({
      container: '.quicklearn-courses-slider',
      items: 1,
      slideBy: 'page',
      autoplay: false,
      gutter: 8,
      controls: false,
      navPosition: "bottom",
      loop: false,
      mouseDrag: true,
      speed: 500,
      controlsContainer: document.querySelector('.quicklearn-carousel-controls'),
      responsive: {
        600: {
          items: 2,
        },
        768: {
          items: 3,
          gutter: 16,
          controls: true
        }
      }
    });
  });


</script>


<style>
  .quicklearn-courses-wrapper {
    margin: 0 -8px;
  }

  .np-homepage-quicklearn {
    padding: 0 16px;
    margin-bottom: 56px;
  }

  .np-homepage-quicklearn-text {
    padding: 0 0 32px;
    text-align: left;
    display: flex;
  }

  .np-homepage-quicklearn-text .np-homepage-headline {
    font-weight: 400;
    font-size: 24px;
    line-height: 32px;
    color: #333;
    align-self: flex-start;
  }

  .quicklearn-carousel-controls {
    align-self: flex-end;
    display: flex;
  }

  .quicklearn-carousel-controls .carousel-control {
    margin: 0 8px;
    background-color: #ebe8f3;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #3c228a;
    cursor: pointer;
    transition: opacity 0.2s;
  }

  .quicklearn-carousel-controls .carousel-control[aria-disabled='true'] {
    opacity: 0.3;
    cursor: default;
  }

  .quicklearn-carousel-controls .carousel-control.next-arrow {
    margin-right: 0;
  }

  .quicklearn-courses-slider {
    display: flex;
  }

  .quicklearn-course-slide {
    margin-bottom: 12px;
  }

  .quicklearn-course-slide .np-card {
    margin: 0 auto;
    padding: 0;
    height: 100%;
  }

  .quicklearn-course-slide .np-card-container {
    height: 100%;
    margin: 0 8px;
  }

  .quicklearn-see-more-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .quicklearn-see-more-wrapper a {
    color: #3C228A;
  }

  @media (min-width:768px) {
    .np-homepage-quicklearn-text {
      flex-direction: row;
      justify-content: space-between;
    }

    .np-homepage-quicklearn-text .np-homepage-headline {
      font-size: 32px;
      line-height: 40px;
    }

    .quicklearn-see-more-wrapper {
      margin-top: 12px;
    }
  }
</style>