<template>
  <div class="md:flex">
    <template v-for="(item, index) in list" :key="item.title">
      <Card
        size="small"
        :loading="loading"
        :title="item.name"
        v-if="index < 6"
        class="md:w-1/6 w-full !md:mt-0 !mt-6"
        :class="[index + 1 < 6 && '!md:mr-6']"
        :canExpan="false"
      >
        <template #extra>
          <Tag :color="item.color">{{ item.action }}</Tag>
        </template>

        <div class="py-4 flex justify-between">
          <CountTo :prefix="item.unit" :startVal="0" :endVal="item.value" class="text-2xl" />
          <!-- <Icon :icon="item.icon" :size="40" /> -->
        </div>

        <div class="flex justify-between">
          <span>{{ item.title }}</span>
          <!-- <CountTo :prefix="item.unit" :startVal="0" :endVal="item.value" /> -->
        </div>
      </Card>
    </template>
  </div>
</template>
<script lang="ts" setup>
  import { CountTo } from '/@/components/CountTo/index';
  import { Icon } from '/@/components/Icon';
  import { Tag, Card } from 'ant-design-vue';
  import { growCardList, GrowCardItem } from '../data';

  defineProps({
    loading: {
      type: Boolean,
    },
    list: {
      type: Array as PropType<Array<GrowCardItem>>,
      default: [],
    },
  });
</script>
