<template>
  <div class="card">
    <div class="card-header">
      <div class="card-title">
        <div class="title">{{ title }}</div>
        <div class="desc">{{ desc }}</div>
      </div>
      <slot name="tools"></slot>
    </div>
    <div class="card-body">
      <slot></slot>
    </div>
  </div>
</template>

<script lang="ts" setup>
defineProps({
  title: {
    type: String,
    default: ''
  },
  desc: {
    type: String,
    default: ''
  }
})
</script>

<style lang="scss" scoped>
.card {
  background: #fff;
  border-radius: 5px;
  margin-bottom: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

  &-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &-title {
    .title {
      font-size: 16px;
      font-weight: 500;
    }
    .desc {
      font-size: 12px;
      color: #909399;
      margin-top: 5px;
    }
  }

  &-body {
    padding: 20px;
  }
}
</style>
