<template>
  <div ref="mySwiper" v-swiper:mySwiper="swiperOption" class="swiper-container container">
    <div class="swiper-pagination">
      <span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span>
      <span class="swiper-pagination-bullet"></span>
    </div>
    <div class="swiper-wrapper">
      <div
        v-for="(item, index) in comment"
        :key="index"
        class="swiper-slide"
      >
        <div class="comment-item">
          <div class="comment-item-text">{{ item.text }}</div>
          <div>
            <div class="info-name">{{ item.name }}</div>
            <div class="info-job">{{ item.job }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { directive } from 'vue-awesome-swiper'
export default {
  directives: {
    swiper: directive
  },
  props: ['comment'],
  data() {
    return {
      swiperOption: {
        loop: true,
        spaceBetween: 30,
        pagination: {
          el: '.swiper-pagination',
          clickable: true
        }
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .swiper-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto;
    padding-top: 60px;
    padding-bottom: 90px;
    background-color: inherit;
    color: #fff;
    text-align: left;
    .swiper-pagination {
      position: absolute;
      text-align: center;
      z-index: 2;
    }
    .swiper-wrapper {
      position: relative;
      width: 100%;
      height: 100%;
      z-index: 1;
      display: -webkit-box;
      display: -webkit-flex;
      display: -ms-flexbox;
      display: flex;
      -webkit-transition-property: -webkit-transform;
      transition-property: -webkit-transform;
      -o-transition-property: transform;
      transition-property: transform;
      transition-property: transform, -webkit-transform;
      -webkit-box-sizing: content-box;
      box-sizing: content-box;
    }
    .swiper-container-android .swiper-slide,
    .swiper-wrapper {
      -webkit-transform: translate3d(0px, 0, 0);
      transform: translate3d(0px, 0, 0);
    }
    .swiper-slide {
      -webkit-flex-shrink: 0;
      -ms-flex-negative: 0;
      flex-shrink: 0;
      width: 100%;
      height: 100%;
      position: relative;
      -webkit-transition-property: -webkit-transform;
      transition-property: -webkit-transform;
      -o-transition-property: transform;
      transition-property: transform;
      transition-property: transform, -webkit-transform;
      height: auto;
    }
  }
  .swiper-container-horizontal > .swiper-pagination-bullets {
    bottom: 40px;
    left: 0;
    width: 100%;
    font-size: 0;
    ::v-deep .swiper-pagination-bullet {
      width: 13px;
      height: 6px;
      display: inline-block;
      margin: 0 3px;
      border-radius: 4px;
      background: #ccc;
      cursor: pointer;
      transition: width 0.3s;
      &.swiper-pagination-bullet-active {
        width: 27px;
        background: #1460F3;
      }
    }
  }
  .comment-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 20px 30px;
    background-color: #FFFFFF;
    box-shadow: 0px 0px 31px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    .comment-item-text {
      margin-bottom: 40px;
      font-size: 14px;
      line-height: 20px;
      color: #606972;
    }
    .info-name {
      margin-bottom: 7px;
      font-weight: bold;
      font-size: 12px;
      line-height: 14px;
      letter-spacing: 0.5px;
      color: #1D2023;
    }
    .info-job {
      font-size: 12px;
      line-height: 14px;
      letter-spacing: 0.3px;
      color: #606972;
    }
  }
  @media screen and (min-width: 930px) {
    .swiper-container {
      display: none;
    }
  }
</style>
