<template>
  <div class="stats-card">
    <div class="stats-card__header">
      <div class="stats-card__title">{{ title }}</div>
    </div>
    <div class="stats-card__content">
      <div class="stats-card__number">{{ total }}</div>
      <div v-for="(item, index) in items" :key="index" class="stats-card__trend">
        <span
          >{{ item.label }}: <span class="value">{{ item.value }}</span></span
        >
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue'

defineProps({
  title: String,
  total: Number,
  items: Array
})
</script>

<style lang="less" scoped>
.stats-card {
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  padding: 10px 20px;

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
  }

  &__title {
    font-size: 16px;
    font-weight: 500;
  }

  &__content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  &__number {
    font-size: 32px;
    font-weight: 600;
    margin: 10px 0;
  }

  &__trend {
    font-size: 14px;
    width: 100%;
    text-align: center;
    margin: 5px 0;

    span {
      color: #606266;
    }
    .value {
      font-size: 16px;
    }
  }
}
</style>
