<template>
  <Slider
    v-if="images && images.length"
    :data="images"
    :arrows-enabled="true"
    class="brand-images-slider-container"
  >
    <template #default="{ item }">
      <img :src="item" alt="brand-images" />
    </template>
  </Slider>
</template>

<script>
import Slider from '@inside-slideshow/components/lib/Slider'

import BrandsMixin from '../../../mixins/brands'

export default {
  name: 'BrandImagesSlider',
  components: { Slider },
  mixins: [BrandsMixin],
  data() {
    return {
      images: [],
      currentBrand: null
    }
  },
  async beforeMount() {
    this.currentBrand = await this.getCurrentBrand()

    this.images = this.currentBrand.content

    this.images =
      this.images &&
      this.images
        .map(({ image }) => this.$_getContentImage(image, 'image-card'))
        .splice(0, 5)
  }
}
</script>

<style lang="scss">
.my-brand-container {
  .slider-container {
    padding: 0;

    .swiper-slide {
      padding: 0;

      img {
        max-height: 240px;
        object-fit: cover;
      }
    }

    .swiper-button-next,
    .swiper-button-prev {
      width: 10px;
      height: 10px;
      margin-top: calc(var(--spacing-m) * (-1));
    }

    .swiper-button-next::after,
    .swiper-button-prev::after {
      border-color: var(--color-light);
    }

    .swiper-button-next::before,
    .swiper-button-prev::before {
      position: absolute;
      top: initial;
      left: initial;
      width: 35px;
      height: 24px;
      padding: 1px;
      border-style: solid;
      border-radius: var(--radius-m);
      content: '';
    }

    .swiper-button-next::before {
      transform: rotate(-45deg) translate(5px, 2%);
    }

    .swiper-button-prev::before {
      transform: rotate(-45deg) translate(-5px, 2%);
    }

    .swiper-pagination {
      text-align: center;
    }

    .swiper-pagination-bullet {
      width: 17%;
      height: 6px;
      border-radius: 0;
    }
  }
}
</style>
