<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="timeline">
    <div v-for="item in listConfig" :key="item.prop" class="flex items-center timeline-item">
      <div class="timeline-item__icon" :class="`timeline-item__icon_${item.color}`"></div><div class="timeline-item__dot"></div>
      <div class="timeline-item__label">{{ item.label }}</div>
      <div :class="`timeline-item__value_${item.color}`">
        {{ item.value }}
      </div>
    </div>
    <div class="timeline-component"></div>
  </div>
</template>
<script lang="ts" setup>
  withDefaults(
    defineProps<{
      listConfig: {
        value: string;
        color: string;
        label: string;
        prop: string;
      }[];
    }>(),
    {
      listConfig: () => [],
    }
  );
</script>
<style lang="less" scoped>
  @import '/@/design/theme.less';
  @import '@/design/theme.less';
  /* Timeline 相关的样式 */

  @{theme-deepblue} {
    .timeline-item {
      --image-warn_icon_5: url('/@/assets/images/themify/deepblue/home-container/configurable/warn_icon_5.png');
      --image-warn_icon_4: url('/@/assets/images/themify/deepblue/home-container/configurable/warn_icon_4.png');
      --image-warn_icon_3: url('/@/assets/images/themify/deepblue/home-container/configurable/warn_icon_3.png');
      --image-warn_icon_2: url('/@/assets/images/themify/deepblue/home-container/configurable/warn_icon_2.png');
      --image-warn_icon_1: url('/@/assets/images/themify/deepblue/home-container/configurable/warn_icon_1.png');
    }
  }

  .timeline-item {
    --image-warn_icon_5: url('/@/assets/images/home-container/configurable/warn_icon_5.png');
    --image-warn_icon_4: url('/@/assets/images/home-container/configurable/warn_icon_4.png');
    --image-warn_icon_3: url('/@/assets/images/home-container/configurable/warn_icon_3.png');
    --image-warn_icon_2: url('/@/assets/images/home-container/configurable/warn_icon_2.png');
    --image-warn_icon_1: url('/@/assets/images/home-container/configurable/warn_icon_1.png');
    height: 20%;
  }
  .timeline-item__icon_red {
    background-image: var(--image-warn_icon_5);
  }
  .timeline-item__icon_orange {
    background-image: var(--image-warn_icon_4);
  }
  .timeline-item__icon_yellow {
    background-image: var(--image-warn_icon_3);
  }
  .timeline-item__icon_green {
    background-image: var(--image-warn_icon_2);
  }
  .timeline-item__icon_blue {
    background-image: var(--image-warn_icon_1);
  }
  .timeline-item__icon {
    width: 33px;
    height: 35px;
    margin-left: 50px;
    background-repeat: no-repeat;
    background-position: center center;
  }
  .timeline-item__dot {
    width: 10px;
    height: 10px;
    margin-left: 70px;
    background-color: @vent-gas-primary-bg;
    border-radius: 5px;
    position: relative;
  }
  .timeline-item__dot::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 16px;
    height: 16px;
    border-radius: 8px;
    border: 1px solid @vent-gas-tab-border;
  }
  .timeline-item__label {
    width: 100px;
    margin-left: 70px;
  }
  .timeline-item__value_red {
    color: red;
  }
  .timeline-item__value_orange {
    color: orange;
  }
  .timeline-item__value_yellow {
    color: yellow;
  }
  .timeline-item__value_green {
    color: yellowgreen;
  }
  .timeline-item__value_blue {
    color: lightblue;
  }

  .timeline {
    height: 220px;
    padding: 5px;
    position: relative;
  }
  .timeline-component {
    position: absolute;
    width: 2px;
    height: 180px;
    top: 20px;
    left: 162px;
    background-image: @vent-configurable-home-timeline;
  }
</style>
