<template>
  <div v-if="isDual" class="common-box">
    <div class="common-content"></div>
    <div class="trapezoid"></div>
    <span class="common-text" :title="text">{{ text }}</span>
  </div>
  <div v-else class="common-box dual-common-box">
    <div class="common-content dual-common-content"></div>
    <div class="trapezoid dual-trapezoid"></div>
    <span class="common-text" style="color: #ffffff" :title="text">{{ text }}</span>
  </div>
</template>

<script setup lang="ts">
defineProps({
  isDual: {
    type: Boolean,
    default: true
  },
  text: {
    type: String,
    default: ''
  }
})
</script>

<style lang="scss" scoped>
.common-box {
  cursor: pointer;
  position: relative;
  width: 422px;
  height: 200px;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-sizing: border-box;

  .common-content {
    width: 390px;
    height: 168px;
    border-radius: 12px;
    border: 1px solid #177cfa;
  }

  .trapezoid {
    position: absolute;
    width: 100px;
    height: 0;
    left: -31px;
    bottom: 31px;
    border-bottom: 25px solid #a3e4ff;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    transform: rotate(225deg);
  }

  .common-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #177cfa;
    font-size: 30px;
    width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

.dual-common-box {
  background: #177cfa;
  color: #ffffff;

  .dual-common-content {
    border: 1px solid #ffffff;
  }

  .dual-trapezoid {
    background: linear-gradient(180deg, #a3e4ff 0%, #5b9cff 100%);
  }
}
</style>
