<template>
  <div class="video-card" >
    <div class="img-box">
      <img :src="cardData.imgUrl">
      <i @click="cardClick"></i>
    </div>
    <h4 v-if="cardData.title">{{cardData.title}}</h4>
    <p v-if="cardData.des">{{cardData.des}}</p>
  </div>
</template>

<script>
export default {
  name: "videoCard",
  props: {
    cardData: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    cardClick() {
      this.$emit('card-click', this.cardData)
    }
  }
}
</script>

<style lang="scss" scoped>
.video-card {
    width: 370px;
    height: 210px;
  .img-box {
    position: relative;
    background: greenyellow;
    width: inherit;
    height: inherit;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      transition: all .5s ease;
    }

    &:hover{img{transform: scale(1.1);}}

    i {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-30px,-30px);
      display: inline-block;
      width: 60px;
      height: 60px;
      background-image: url("~static/images/client/course/course-video-icon.svg");
      background-repeat: no-repeat;
      cursor: pointer;
    }
  }
  h4 {
    font-size: 24px;
    font-weight: 800;
    color: #333;
    text-align: center;
    margin-top: 25px;
  }
  p {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-align: center;
    margin-top: 25px;
  }
}
@media (max-width: 768px) {
  .video-card {
    width: 100%;
    height: 100%;

    .img-box {
      position: relative;
      background: greenyellow;
      width: inherit;
      height: inherit;
      overflow: hidden;

      img {
        width: 100%;
        min-height: 160px;
        transition: all .5s ease;
      }
    }

    h4 {
      font-size: 16px;
      font-weight: 800;
      color: #333;
      text-align: center;
      margin-top: 15px;
    }

    p {
      font-size: 12px;
      font-weight: 500;
      color: #333;
      text-align: center;
      margin-top: 15px;
    }
  }
}
</style>
