<template>
  <el-card :body-style="{ padding: '0px' }" shadow="always">
    <div class="card-panel" >
      <div :style="backgroundColor" 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
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    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: #fff;
  }
  }

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

  .card-panel-icon {
    float: left;
    font-size: 48px;
  }

  .card-panel-description {
    float: left;
    font-weight: bold;
    margin: 26px;
    margin-left: 10px;

  .card-panel-text {
    line-height: 18px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 16px;
    margin-bottom: 12px;
  }

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