<template>
  <div class="ui-chart-panel" :style="{'height': height}">
    <div class="ui-chart-panel__head">
      <div class="ui-chart-panel__head-left">
        <h4 class="ui-chart-panel__title" v-if="title">{{title}}</h4>
        <p class="ui-chart-panel__description" v-if="description || $slots.description">
          <slot name="description">{{description}}</slot>
        </p>
      </div>
      <div class="ui-chart-panel__head-right" v-if="$slots.addon">
        <slot name="addon"></slot>
      </div>
    </div>
    <div class="ui-chart-panel__body">
      <slot></slot>
    </div>
  </div>
</template>
<script>
export default {
  name: 'UiChartPanel',
  props: {
    title: {
      type: String
    },
    description: {
      type: String
    },
    height: {
      type: String,
      default: '100%'
    }
  }
}
</script>
<style lang="less">
.ui-chart-panel{
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.ui-chart-panel__head{
  padding-bottom: 24px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.ui-chart-panel__head-right{
  margin-left: 24px;
}
.ui-chart-panel__title,
.ui-chart-panel__description{
  margin: 0;
  padding: 0;
  line-height: 22px;
}
.ui-chart-panel__title{
  margin-bottom: 4px;
  font-size: 16px;
}
.ui-chart-panel__description{
  font-size: 12px;
  color: #C5C7CD;
}
.ui-chart-panel__body{
  flex: 1;
  min-height: 0;
}
</style>
