<template>
  <div class="info">
    <div 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
}

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

<style scoped lang="less">
.info {
  background-color: #f5f5f5;
  border-radius: 10px;
  padding: 12px;
  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    &-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
    }
    &-extra {
      font-size: 14px;
    }
  }

  &-content {
    display: flex;
    flex-direction: column;
  }
}
</style>
