<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <!-- 基准的列表模块，通过不同的 type 展示不同的样式 -->
  <div class="list flex items-center" :class="`list_${type}`">
    <!-- 部分类型的列表需要加一张图片 -->
    <div :class="`list__image_${type}`"></div>
    <!-- 剩下的部分填充剩余宽度 -->
    <div class="flex-grow h-full" :class="`list__wrapper_${type}`">
      <div v-for="(item, i) in listConfig" :key="`vvhccdcl${i}`" :class="`list-item_${type}`">
        <!-- 列表项前面的图标 -->
        <div :class="`list-item__title_${type}`">{{ item.title }}</div>
        <!-- 列表项的具体内容填充剩余宽度 -->
        <div v-for="(ctx, j) in item.contents" :key="`vvhccdclc${j}`" :class="`list-item__content_${type}`">
          <div class="list-item__label">{{ ctx.label }}</div>
          <div class="list-item__info" :class="`list-item__info_${ctx.color}`">{{ ctx.info }}</div>
          <div class="list-item__value" :class="`list-item__value_${ctx.color} list-item__value_${type}`">{{ ctx.value }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  withDefaults(
    defineProps<{
      listConfig: {
        title: string;
        contents: {
          value: string;
          color: string;
          label: string;
          info: string;
        }[];
      }[];
      /** A B */
      type: string;
    }>(),
    {
      listConfig: () => [],
      type: 'A',
    }
  );

  //   defineEmits(['click']);
</script>
<style lang="less" scoped>
  @import '@/design/theme.less';

  @{theme-dark} {
    .list {
      --image-linear-gradient-1: linear-gradient(to right, #39a3ff50, #39a3ff00);
    }
  }

  .list {
    --image-linear-gradient-1: linear-gradient(to right, #39a3ff50, #39a3ff00);
    --image-linear-gradient-2: linear-gradient(to right, #3df6ff40, #3df6ff00);
    --image-linear-gradient-3: linear-gradient(to right, #39deff15, #3977e500);
    padding: 5px 20px;
    position: relative;
    width: 100%;
    height: 100%;
  }

  // .list-item__title_B_O2 {
  //   background-image: url(/@/assets/images/home-container/configurable/firehome/O₂.png);
  // }
  // .list-item__title_B_CH4 {
  //   background-image: url(/@/assets/images/home-container/configurable/firehome/CH₄.png);
  // }
  // .list-item__title_B_CO {
  //   background-image: url(/@/assets/images/home-container/configurable/firehome/CO.png);
  // }
  // .list-item__title_B_CO2 {
  //   background-image: url(/@/assets/images/home-container/configurable/firehome/CO₂.png);
  // }

  // .list-item__label {
  //   flex-basis: 55%;
  // }
  // .list-item__info {
  //   flex-grow: 1;
  // }
  // .list-item__value {
  //   flex-basis: 30%;
  // }
  .list-item__value_red {
    color: red;
  }
  .list-item__value_orange {
    color: orange;
  }
  .list-item__value_yellow {
    color: yellow;
  }
  .list-item__value_green {
    color: yellowgreen;
  }
  .list-item__value_blue {
    color: aqua;
  }
  .list-item__value_white {
    color: white;
  }
</style>
