<template>
    <div class="card">
        <div class="card-header">
            <div class="card-lf">
              <img :src="icon" alt="icon" class="icon"/>
              <span class="title">{{ title }}</span>
              <span v-if="subTitle" class="sub-title">（{{subTitle}}）</span>
            </div>
        </div>
        <div class="card-body">
          <slot></slot>
        </div>
    </div>
</template>

<script>
export default {
  name: 'card',
  props: {
    title: {
      type: String,
      default: ''
    },
    subTitle: {
      type: String,
      default: ''
    },
    icon: {
      type: String,
      default: ''
    }
  }
}
</script>
<style scoped lang="scss">
@import '@/assets/css/function.scss';
@import '@/assets/css/theme.scss';
.card {
    width: 100%;
    height: 100%;
    box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(14,22,41,1) 0%,rgba(14,22,41,0.6) 100%);
    .card-header{
      color: rgba(185, 227, 244, 1);
      font-size: halfW(16);
      padding:  halfH(4) halfW(10);
      background: var(--title-bg);
      .title{
        display: inline-block;
        vertical-align: middle;
      }
      .icon{
        width: halfW(28);
        height: halfW(28);
        vertical-align: middle;
        margin-right: halfW(8);
      }
      .sub-title{
        font-size: halfW(12);
      }
    }
    .card-body{
      padding: halfH(16) halfW(10);
      box-sizing: border-box;
      height: calc(100% - halfH(8) - halfH(16) - halfW(28));
    }
}
</style>
