<template>
  <div class="analysis-box-wrapper" :style="{ width: width ? width : '100%', height: height ? height : '100%' }">
    <div class="wrapper-header">
      <div class="header-icon"></div>
      <div class="header-title">{{ title }}</div>
      <div class="header-right">
        <div class="header-right-btn" @click="handleSave" v-if="showAllBtn">
          <img src="@/assets/icons/box-header-icon1.png" alt="">
        </div>
        <div class="header-right-btn" @click="handleDownload">
          <img src="@/assets/icons/box-header-icon2.png" alt="">
        </div>
        <div class="header-right-btn" @click="handleCollect">
          <img src="@/assets/icons/box-header-icon3.png" alt="">
        </div>
      </div>
    </div>
    <div class="wrapper-main">
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'

const props = defineProps({
  title: {
    type: String,
    default: ''
  },
  width: {
    type: String,
    default: ''
  },
  height: {
    type: String,
    default: ''
  },
  showAllBtn: {
    type: Boolean,
    default: true
  }
})

const handleSave = () => {
  alert('save')
}

const handleDownload = () => {
  alert('download')
}

const handleCollect = () => {
  alert('collect')
}


</script>

<style lang="scss" scoped>
.analysis-box-wrapper {
  border: 1px solid rgba(234, 236, 238, 1);
  border-radius: 10px;
  box-shadow: 0px 0px 20px 0px rgba(25, 69, 130, 0.1);
  background: rgba(255, 255, 255, 1);

  .wrapper-header {
    height: 45px;
    display: flex;
    box-sizing: border-box;
    position: relative;

    .header-icon {
      margin-top: 18px;
      width: 8px;
      height: 20px;
      background: var(--color-main-active);
      border-radius: 0 4px 4px 0;
    }

    .header-title {
      margin-left: 14px;
      margin-top: 14px;
      height: 26px;
      color: var(--color-main-active);
      font-family: Source Han Sans CN;
      font-style: Bold;
      font-size: 20px;
      font-weight: 700;
      line-height: 26px;
      letter-spacing: 0px;
    }

    .header-right {
      position: absolute;
      top: 14px;
      right: 12px;
      height: 28px;
      display: flex;
      justify-content: flex-end;
      gap: 4px;

      .header-right-btn {
        width: 28px;
        height: 28px;
        cursor: pointer;

        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }

  .wrapper-main {
    height: calc(100% - 45px);
    overflow: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 5px 10px;
  }
}
</style>
