<template>
  <div>
    <div class="leftInfo">
      <div class="leftInfo_title">{{ title }}</div>
      <div class="leftInfo_value">{{ value }}</div>
      <div class="leftInfo_growth" :style="{ color: growthColors[upStatus + 1] }">
        <el-icon
          ><Top v-if="upStatus == 1" /><SemiSelect v-if="upStatus == 0" /><Bottom
            v-if="upStatus == -1"
        /></el-icon>
        {{ growth }}
      </div>
    </div>
    <div class="icon" :style="{ background: iconColor + '32' }">
      <el-icon>
        <component :is="iconName" :color="iconColor" />
        <!-- <Flag :color="iconColor" /> -->
      </el-icon>
    </div>
  </div>
</template>

<script>
export default {
  name: "card",
  props: {
    title: {
      type: String,
      default: "",
    },
    value: {
      type: String,
      default: "-",
    },
    growth: {
      type: String,
      default: "",
    },
    iconColor: {
      type: String,
      default: "#CCCCCC",
    },
    iconName: {
      type: String,
      default: "WalletFilled",
    },
    upStatus: {
      type: Number,
      //   -1 下降
      //   0 持平
      //   1 上升
      default: -1,
    },
  },
  data() {
    return {
      // 0 下降
      // 1 持平
      // 2 上升
      growthColors: ["#F56C6C", "#909399", "#67C23A"],
    };
  },
};
</script>

<style lang="less" scoped>
.leftInfo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.leftInfo_title {
  font-size: 12px;
  color: #909399;
  line-height: 20px;
}
.leftInfo_value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: bold;
  line-height: 33px;
}
.leftInfo_growth {
  margin-top: 12px;
  font-size: 12px;
  line-height: 20px;
  font-weight: bold;
}
.icon {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  background: #ccc;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
