<template>
  <AppCard :title="isEn ? 'Excellent Teachers' : '优秀师资'">
    <swiper ref="mySwiper" :options="swiperOptions" class="teacher-list">
      <swiper-slide v-for="(item, index) in list" :key="index" class="teacher-item">
        <div class="teacher-item-inner">
          <img :src="item.imgUrl" />
        </div>
        <div class="teacher-item-cover">
          <h3>{{ item.name }}</h3>
          <p>{{ item.project }}</p>
          <div v-html="item.desc" class="desc"></div>
        </div>
      </swiper-slide>
    </swiper>
  </AppCard>
</template>
<script>
import AppCard from '@/components/AppCard.vue'
export default {
  name: 'TeacherCard',
  props: { list: { type: Array, default: () => [] } },
  components: { AppCard },
  data() {
    return {
      isEn: false,
      swiperOptions: {
        autoplay: true,
        loop: true,
        slidesPerView: 'auto',
        spaceBetween: 20
      }
    }
  },
  mounted() {
    this.isEn = this.$cookies.get('lang') === 'en-US'
  }
}
</script>

<style lang="scss" scoped>
.teacher-list {
  margin-bottom: 60px;
}

.teacher-item {
  width: 224px;
  height: 430px;
  background: rgba(255, 255, 255, 0.39);
  cursor: pointer;
  position: relative;

  &:hover {
    box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.1);
  }
}

.teacher-item-inner {
  position: relative;
  height: 200px;
  padding: 13px 12px 0 12px;

  img {
    width: 200px;
    height: 100%;
    object-fit: cover;
  }
  p {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 20px;
    height: 34px;
    font-size: 16px;
    line-height: 34px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.39);
  }
}
.teacher-item-cover {
  text-align: center;
  margin-top: 21px;
  // position: absolute;
  // left: 0;
  // top: 0;
  // right: 0;
  // bottom: 0;
  // background: #a81840;
  // color: #fff;
  // padding: 10px;
  // transform: translateY(100%);
  // transition: all 0.3s;
  h3 {
    font-size: 16px;
    font-weight: 500;
    color: #000000;
  }
  p {
    margin-top: 4px;
    text-align: center;
    font-size: 14px;
    color: #333333;
  }
  .desc {
    font-size: 14px;
    margin-top: 20px;
    color: #575964;
    padding: 0 5px 0 5px;
  }
}
</style>
