<script setup lang="ts">

const { locale } = useI18n();

interface IPropData {
  title: string,
  titleKey: string,
  subTextOne: string,
  subTextTwo: string,
  content: string,
  list: { iconName: string, val: string, langKey: string }[],
  [key:string]: any
}

defineProps<{
  direction: "left" | "right",
  data: IPropData,
  position: "top" | "center" | "bottom" 
}>()

</script>

<template>
  <div :class="['introduce-card', 'direction-' + direction, position, locale ]">
    <div class="title-wrap">
     <h3 class="title">{{$t(data.titleKey)}}</h3>
      <p class="sub-title">{{$t(data.subTextOneLangKey || '')}}</p>
      <p class="sub-title">{{$t(data.subTextTwoLangKey || '')}}</p>
    </div>
    <!-- :data-aos='"slide-" + direction' -->
    <div class="content-wrap">
      <div class="column-area">
        <div class="img-card" data-aos="fade-up">
          <img :src="data.floatUrl" alt="">
        </div>
        <div class="desc-card">
          <p class="desc-text">{{ $t(data.contentKey) }}</p>
          <div class="line"></div>
          <ul class="desc-list">
            <li :class="
              ['desc-item']
            " v-for="(item, index) in data.list" :key="index">
              <BaseIcon :name="item.iconName" width="22" height="22" />
              <span class="text">{{$t(item.langKey)}}</span>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.introduce-card {

  &:not(:last-child) {
    padding-bottom: 87px;
  }

  .title-wrap {
    max-width: 1080px;
    margin: 0 auto;

    .title {
      display: inline-block;
      padding-bottom: 24px;
      font-size: 36px;
      font-weight: bold;
      line-height: 44px;
      color: $t-color-primary;
    }

    .sub-title {
      font-size: 16px;
      line-height: 28px;
      color: $t-color-sub-text;
    }
  }

  .content-wrap {
    position: relative;
    display: flex;
    justify-content: flex-start;
    margin-top: 53px;
    background-size: 50% 100%;
    font-size: 18px;
    line-height: 30px;
    text-align: justify;
    color: #fff;

    .column-area {
      position: relative;
      width: 1080px;
      margin: 0 auto;
      border-radius: 8px 0px 0px 8px;
    }

    .img-card {
      position: absolute;
    }

    .desc-card {
      display: flex;
      flex-flow: column;
      align-items: flex-start;
      justify-content: center;
      width: 50%;
      height: 388px;
      padding: 0px 50px;

      .desc-list {
        display: grid;
        grid-gap: 16px;
        grid-template-columns: repeat(2, minmax(84px, 1fr));
        .desc-item {
          @include flex(x, center, start);
          .text {
            padding-left: 8px;
          }
        }
      }
    }

    .right {
      flex: 1;
      background: red
    }

    .line {
      width: 64px;
      height: 12px;
      margin: 24px 0 18px 0;
      background: linear-gradient(90deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
    }
  }
}

.top {
  .content-wrap {
    background: url("https://static.fuxicarbon.com/newsequoialibra/images/bg-home-fetaure-01.png") right 50% no-repeat;
    background-size: 50% 100%;
    .desc-card {
      background: linear-gradient(121.87deg, #315BFF 16.41%, #3996FF 88.25%);
    }
    .img-card {
      bottom: 0;
      left: 42%;
      width: 628px;
    }
  }
}

.center {
  .content-wrap {
    background: url("https://static.fuxicarbon.com/newsequoialibra/images/bg-home-fetaure-02.png") left 50% no-repeat;
    background-size: 50% 100%;
    .desc-card {
      background: linear-gradient(215deg, #25D4FA 16.41%, #2C96F9 88.25%);
    }
    .img-card {
      bottom: 0%;
      left: 17%;
      width: 400px;
    }
  }
}

.bottom {
  .content-wrap {
    background: url("https://static.fuxicarbon.com/newsequoialibra/images/bg-home-fetaure-03.png") right 50% no-repeat;
    background-size: 50% 100%;
    .desc-card {
      background: linear-gradient(121.87deg, #9DED98 16.41%, #43C1D2 88.25%);
    }
    .img-card {
      bottom: 0%;
      left: 47%;
      width: 492px;
    }
  }
}

.direction-left {
  .content-wrap {
    .desc-card {
      border-top-left-radius: 8px;
      border-bottom-left-radius: 8px;
      overflow: hidden;
    }
  }
}

.direction-right {
  .title-wrap {
    text-align: right;
  }
  .content-wrap {
    .column-area {
      display: flex;
      justify-content: flex-end;
    }
    .desc-card {
      border-top-right-radius: 8px;
      border-bottom-right-radius: 8px;
    }
  }
}

.en {
  .content-wrap {
    .desc-card {
      justify-content: center;
      padding: 20px;
      font-size: 16px;
      .desc-text {
        text-align: start;
        line-height: 22px;
      }
      .desc-list {
        font-size: 12px;
      }
    }
  }
  &.direction-right {
    .content-wrap {
      .desc-card {
        padding-left: 50px;
      }
    }
  }
}

@media screen and (max-width: 768px) {
  .direction-left, .direction-right {
    .title-wrap {
      padding: 10px;
      text-align: center;
    }
    .content-wrap {
      font-size: 16px;
      .column-area {
        width: 100%;
        .img-card {
          display: none;
        }
        .desc-card {
          width: 100%;
          height: auto;
          padding: 14px;

          .desc-list {
            .desc-item {
              font-size: 14px;
            }
          }
        }
      }
    }
  }
}
</style>