<div class="np-homepage-feature np-max-width">
  <div class="np-homepage-feature-text">
    <div class="np-homepage-headline">
      Available Content
    </div>
    <div class="feature-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 available_courses_count = 0 %}
    <div class="feature-courses-wrapper">
      <div class="feature-courses-slider">
        {% for course in items %}
					{% if course.started? == false %}
              {% assign available_courses_count = available_courses_count | plus: 1 %}

              <div class="feature-course-slide">
                {% include "cards_course_ongoing" with course %}
              </div>
            {% endif %}
        {% endfor %}
      </div>
    </div>

    {% if available_courses_count > 0 %}
      <div class="feature-see-more-wrapper">
        <a href="/app/dashboard">See more</a>
      </div>
    {% else %}
      <script>console.log("{{available_courses_count}}")</script>
      <div class="np-homepage-featured-empty">
        <div class="np-zero-state-text">
          Sorry, you don't have any Ongoing content at this moment.
        </div>
        <img class="np-zero-state-courses" alt="Sorry, you don't have any Featured content at this moment." />
        <div class="zero-state-cta" style="margin-top:32px;">
          <a href="/app/dashboard" class="np-button">Explore Dashboard</a>
        </div>
      </div>
    {% endif %}
  {% else %}
    <div class="np-homepage-featured-empty">
      <div class="np-zero-state-text">
        Sorry, you don't have any Available content at this moment.
      </div>
      <img class="np-zero-state-courses" alt="Sorry, you don't have any Featured content at this moment." />
      <div class="zero-state-cta" style="margin-top:32px;">
        <a href="/app/dashboard" class="np-button">Explore Dashboard</a>
      </div>
    </div>
  {% endif %}
</div>


<script>

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

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


</script>


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

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

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

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

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

  .feature-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;
  }

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

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

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

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

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

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

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

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

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

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

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