<template>
  <el-card :body-style="{ padding: '0px' }" shadow="always">
    <div :style="backgroundColor" class="card-panel">
      <div class="card-panel-icon-wrapper">
        <svg-icon :icon-class="icon" class-name="card-panel-icon" />
      </div>
      <div class="card-panel-description">
        <div class="card-panel-text">
          {{ title }}
        </div>
        <div class="card-panel-num" >
          {{ context }}
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  name: 'Card',
  props: {
    title: {
      type: String,
      default: '标题'
    },
    subtitle: {
      type: String,
      default: ''
    },
    icon: {
      type: String,
      default: ''
    },
    context: {
      type: [String, Number],
      default: ''
    },
    color: {
      type: String,
      default: '#40c9c6'
    }
  },
  computed: {
    backgroundColor() {
      return {
        // color: this.color,
        'background-color': this.color
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .card-panel {
    height: 192px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #ffffff;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

  &:hover {
    .card-panel-icon-wrapper {
      color: #ffffff;
    }
  }

  .card-panel-icon-wrapper {
    margin: 16px 0 0 0px;
    padding: 14px;
    transition: all 0.38s ease-out;
    border-radius: 6px;
    text-align: center;
  }

  .card-panel-icon {
    font-size: 58px;
  }

  .card-panel-description {
    font-weight: bold;
    margin: 26px;
    /*margin-left: 10px;*/
    text-align: center;

  .card-panel-text {
    line-height: 22px;
    color: #ffffff;
    font-size: 20px;
    margin-bottom: 12px;
  }

  .card-panel-num {
    font-size: 20px;
  }
  }
  }
</style>
