<template>
  <div class="bg-card">
    <div class="card-header">
      <slot name="title">
        <h3 class="card-title text-clip">
          <span v-if="icon" class="title-icon">
            <bg-icon :icon="icon" />
          </span>
          <span v-if="easyIcon" class="easy-icon"></span>
          <span class="title-text">{{ title }}</span>
          <span v-if="subTitle" class="subtitle-text">{{ subTitle }}</span>
        </h3>
      </slot>
      <slot name="title-extra"></slot>
    </div>
    <div ref="content" class="card-content">
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
  subTitle: {
    type: String,
    default: "",
  },
  icon: {
    type: String,
    default: "",
  },
  easyIcon: {
    type: Boolean,
    default: false,
  },
});
</script>

<style scoped>
.easy-icon {
  width: 4px;
  height: 14px;
  background-color: #3759be;
  border-radius: 2px;
  margin-right: 8px;
}
.subtitle-text {
  font-size: 14px;
  color: #909bb6;
  font-weight: 400;
  line-height: 5px;
  margin-top: 4px;
}
</style>
