<template>
  <div class="data__item">
    <div class="data__item__content">
      <div class="progress">
        <div
          class="progress_rate"
          :style="{ width: `${(data / count) * 100}%`, background: progerssColor }"
        ></div>
        <text>{{ data }}</text>
      </div>
    </div>
    <div class="data__item__icon">
      <img class="full-w-h" :src="getIcon" />
    </div>
  </div>
</template>
<script setup lang="ts">
const props = defineProps<{
  data: number
  count: number
  progerssColor: string
  iconName: string
}>()
const OSS_URL = import.meta.env.VITE_OSS_URL
const getIcon = `${OSS_URL}/xuexiaole_clinet/learnWord/${props.iconName}.png`
</script>
<style scoped lang="scss">
.data__item {
  position: relative;
  & + .data__item {
    margin-left: 80px;
  }

  .data__item__icon {
    width: 6vh;
    height: 6vh;
    position: absolute;
    left: -20px;
    top: -0.33vh;
  }

  .data__item__content {
    border-radius: 3vh;
    border: 0.33vh solid #fffef2;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    overflow: hidden;

    .progress {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;

      .progress_rate {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: 50%;
        height: 100%;
      }
      text {
        position: relative;
        padding: 0.33vh 40px 0.33vh 72px;
        color: #fff;
        text-align: center;
        font-family: $font-text;
        font-size: 2.67vh;
        text-shadow: 0 0.17vh 0.25vh rgba(0, 0, 0, 0.35);
        z-index: 1;
      }
    }
  }
}
</style>
