<template>
  <div class="vm-perm-section">
    <div v-if="title || $slots.extra" class="vm-perm-section__head">
      <div v-if="title" class="vm-perm-section__title">{{ title }}</div>
      <div v-if="$slots.extra" class="vm-perm-section__extra">
        <slot name="extra" />
      </div>
    </div>
    <div class="vm-perm-section__body">
      <slot />
    </div>
  </div>
</template>

<script setup lang="ts">
defineOptions({ name: 'vm-perm-section' })

defineProps<{
  title?: string
}>()
</script>

<style lang="scss" scoped>
.vm-perm-section {
  grid-column: span 12;
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.vm-perm-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vm-perm-section__title {
  font-size: 13px;
  font-weight: 650;
  color: var(--foreground);
}

.vm-perm-section__extra {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.vm-perm-section__body {
  min-width: 0;
  min-height: 0;
}
</style>
