<template>
  <div class="info">
    <div v-if="props.title" class="info-header">
      <div class="info-header-title">{{ props.title }}</div>
      <div class="info-header-extra"><slot name="extra"></slot></div>
    </div>

    <div class="info-content">
      <slot></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: 'InfoCard',
})

type Props = {
  title?: string
  subtitle?: string
}

const props = withDefaults(defineProps<Props>(), {
  title: '',
  subtitle: '',
})
</script>

<style scoped lang="less">
.info {
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: #fff;
  min-width: 350px;
  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    line-height: 2;
    font-weight: 600;
    &-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
    }
    &-extra {
      font-size: 16px;
    }
  }

  &-content {
    display: flex;
    flex-direction: column;
    min-height: 350px;
    padding: 12px;
  }
}
</style>
