<template>
  <div class="card-item">
    <slot name="header">
      <div class="header" :style="{marginBottom: titleGap + 'px'}">
        <div class="header-title">{{ title }}</div>
        <div class="header-extra" v-if="$slots.headerExtra">
          <slot name="headerExtra"></slot>
        </div>
      </div>
    </slot>

    <div class="content" v-if="$slots.content" :style="{gap: contentGap + 'px'}">
      <slot name="content"></slot>
    </div>

    <slot />
  </div>
</template>
<script setup>
import { onMounted, ref } from 'vue'

const props = defineProps({
  title: {
    type: String,
    default: ''
  },
  titleGap: {
    type: [Number, String],
    default: 16
  },
  contentGap: {
    type:[ Number, String],
    default: 8
  }
})

</script>
<style scoped lang="scss">
.card-item {
  position: relative;
  width: 100%;
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.header-title {
  font-weight: 500;
  font-size: 15px;
  color: #4a4a4a;
  line-height: 16px;
}
.content {
  display: flex;
  flex-direction: column;
}
</style>
