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

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

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

type Props = {
  title?: string
}

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

<style scoped lang="less">
.info-item-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  &-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px;
  }
  &-content {
    padding: 12px;
  }
  &:last-child {
    margin-bottom: 0;
  }
}
</style>
