<script setup lang="ts">
const props = defineProps<{ title?: string; full?: boolean }>()
const styleHeight = computed(() => {
  return props.full ? 'calc(100vh - 90px)' : 'auto'
})
</script>

<template>
  <div class="app-card">
    <div class="app-card-hd">
      <slot name="header">
        <h2 class="app-card-hd__title" v-if="title">{{ title }}</h2>
        <div class="app-card-hd-aside">
          <slot name="header-aside"></slot>
        </div>
      </slot>
    </div>
    <div class="app-card-bd">
      <slot></slot>
    </div>
  </div>
</template>

<style lang="scss">
.app-card {
  display: flex;
  flex-direction: column;
  min-height: v-bind(styleHeight);
  background: #fff;
  box-shadow: 0 1px 6px 0 rgb(228 232 235 / 20%);
  border-radius: 6px;
  padding: 20px;
  box-sizing: border-box;
}
.app-card + .app-card {
  margin-top: 20px;
}
.app-card-hd {
  display: flex;
}
.app-card-hd__title {
  flex: 1;
  padding-left: 5px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 24px;
  border-left: 3px solid #aa1941;
  &.small {
    font-size: 14px;
  }
}
.app-card-bd {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
}
.h2-title {
  padding-left: 5px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  color: #aa1941;
  margin: 20px 0;
  border-left: 3px solid #aa1941;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>
