<template>
  <div class="video-list">
    <nuxt-link class="video-list-title" :to="link">
      <div class="video-list-title-text">{{ podcast.category.name }}</div>
      <div class="video-list-title-link">
        <div class="button button_podcast-transparent">
          <BaseIcon name="play" />
        </div>
      </div>
    </nuxt-link>

    <div class="video-list-items">
      <VueSlickCarousel v-bind="settings" v-if="podcast.news.length">
        <div
          class="video-list-item-wrapper"
          v-for="item in this.podcast.news.slice(0, 15)"
          :key="item.id"
        >
          <PodcastItem :item="item"></PodcastItem>
        </div>
        <template #prevArrow="arrowOption">
          <button
            class="
              video-slider-control
              button_podcast-slider button_video-slider button_video-slider-prev
            "
          >
            <BaseIcon name="h-slider-prev" clear />
          </button>
        </template>

        <template #nextArrow="arrowOption">
          <button
            class="
              video-slider-control
              button_podcast-slider button_video-slider button_video-slider-next
            "
          >
            <BaseIcon name="h-slider-next" clear />
          </button>
        </template>
      </VueSlickCarousel>
    </div>
  </div>
</template>

<script>
import VueSlickCarousel from "vue-slick-carousel";

export default {
  components: {
    VueSlickCarousel,
  },

  props: {
    podcast: {
      type: Object,
      required: true,
    },
  },

  data: () => ({
    settings: {
      draggable: true,
      dots: true,
      arrows: true,
      slidesToShow: 3,
      slidesToScroll: 3,
      responsive: [
        {
          breakpoint: 900,
          settings: {
            slidesToShow: 2,
          },
        },
        {
          breakpoint: 768,
          settings: {
            slidesToShow: 1,
          },
        },
      ],
    },
  }),

  computed: {
    link() {
      return {
        name: "podcasts-category",
        params: {
          category: this.podcast.category.alias,
        },
      };
    },
  },
};
</script>

<style lang="less" scoped>
.video-list {
  &-title {
    display: flex;
    align-items: center;
    cursor: pointer;

    &-text {
      color: #000;
      font-size: 24px;
      font-weight: bold;
    }
    &-link {
      margin-left: 15px;
    }
  }
  &-items {
    margin-top: 28px;
    padding-bottom: 28px * 2;
  }
}

::v-deep .slick {
  &-slide {
    padding: 0 12px;
  }
  &-list {
    margin: 0 -12px;
  }
  &-dots {
    width: 100%;
    position: absolute;
    bottom: -28px;
    button {
      background-color: #000;
    };
    .slick-active{
      button {
        background-color: #000;
      };
    }
  }
}
</style>