<template>
  <a-spin :loading="false" style="width: 100%">
    <a-card :bordered="false" :style="cardStyle">
      <div class="content-wrap">
        <div class="content">
          <a-statistic
            :title="title"
            :value="value"
            :value-from="0"
            :value-style="{ color }"
            animation
            show-group-separator
          >
            <template #suffix>{{ suffix }}</template>
          </a-statistic>
        </div>
      </div>
    </a-card>
  </a-spin>
</template>

<script lang="ts" setup>
import { PropType, CSSProperties } from 'vue'

defineProps({
  title: {
    type: String,
    default: ''
  },
  value: {
    type: Number,
    default: 0
  },
  color: {
    type: String
  },
  suffix: {
    type: String,
    default: ''
  },
  cardStyle: {
    type: Object as PropType<CSSProperties>,
    default: () => {
      return {}
    }
  }
})
</script>

<style scoped lang="less">
:deep(.arco-card) {
  border-radius: 4px;
}
:deep(.arco-card-body) {
  width: 100%;
  height: 134px;
  padding: 0;
}
.content-wrap {
  width: 100%;
  padding: 16px;
  white-space: nowrap;
}
:deep(.content) {
  float: left;
  width: 108px;
  height: 102px;
}
:deep(.arco-statistic) {
  .arco-statistic-title {
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
  }
  .arco-statistic-content {
    margin-top: 20px;
  }
}

.chart {
  float: right;
  width: calc(100% - 108px);
  height: 90px;
  vertical-align: bottom;
}

.label {
  padding-right: 8px;
  font-size: 12px;
}
</style>
