<!--
 * @Author: zhp
 * @Date: 2024-06-05 09:43:51
 * @LastEditTime: 2024-07-09 15:35:19
 * @LastEditors: zhp
 * @Description:
-->
<template>
  <div class="copilot-container">
    <!-- refresh btn  -->
    <button v-if="false" style="
        appearance: none;
        outline: none;
        border: none;
        background: none;
        color: #fff;
        cursor: pointer;
        position: absolute;
        top: 8px;
        right: 8px;
      " @click="$emit('refresh')">
      <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
        style="width: 24px; height: 24px">
        <path stroke-linecap="round" stroke-linejoin="round"
          d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" />
      </svg>
    </button>
    <!-- decoration  -->
    <div class="corner tl"></div>
    <div class="corner tr"></div>
    <div class="corner bl"></div>
    <div class="corner br"></div>
    <!-- content  -->
    <div class="container-head" :class="[side == 'left' ? 'gradient-to-right' : 'gradient-to-left']">
      <Icon style="margin-left: 16px;" :icon="icon"></Icon>
      <h2 class="container-title">{{ title }}</h2>
    </div>
    <div class="container-body" :class="[
        side == 'left' ? 'body-gradient-to-right' : 'body-gradient-to-left',
      ]">
      <slot />
    </div>
  </div>
</template>

<script>
import ContainerIconVue from "./ContainerIcon.vue";
export default {
  name: "DashboardContainer",
  components: {
    Icon: ContainerIconVue,
  },
  props: {
    side: {
      type: String,
      default: "left",
    },
    icon: {
      type: String,
      default: "cube",
    },
    title: {
      type: String,
      default: "Default Title",
    },
  },
  data() {
    return {};
  },
  computed: {},
  methods: {},
};
</script>

<style scoped lang="scss">
.copilot-container {
  height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 0 20px 1px #fff1;
  border-left: 0.11415vw solid;
  border-image: linear-gradient(to bottom, transparent 10%,
        #024798 20%,
        transparent 90%) 1;
  backdrop-filter: blur(4px);

  &::before {
    content: "";
    position: absolute;
    display: inline-block;
    height: 92%;
    width: 0.11415vw;
    border-radius: 2px;
    top: 0%;
    right: 0;
    background: radial-gradient(circle at center,
          #024798 2%,
          #024798 100%,
          transparent);
    z-index: 1;
  }

  &::after {
    content: "";
    position: absolute;
    display: inline-block;
    width: 90%;
    height: 0.31415vh;
    border-radius: 2px;
    left: 7%;
    bottom: 0;
    background: linear-gradient(to right,transparent 60%, #024798 95%, transparent 97%);
    z-index: 0;
  }

  .container-head {
    // height: 40px;
    height: 3.8vh;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;

    .container-title {
      font-size: 1vw;
      line-height: 1.39vw;
      font-weight: normal;
      letter-spacing: 2px;
    }
  }

  .container-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 0;
  }

  .corner {
    z-index: 1;
    position: absolute;
    // width: 16px;
    // height: 16px;
    width: 0.95vw;
    height: 0.95vw;
  }

  .corner.tl {
    border-top: 2px solid #0175dc;
    border-left: 2px solid #0175dc;
    top: 0;
    left: 0;
  }

  .corner.tr {
    top: 0;
    right: 0;
    border-top: 2px solid #0175dc;
    border-right: 2px solid #0175dc;
  }

  .corner.bl {
    // width: 20px;
    // height: 20px;
    width: 1.064vw;
    height: 1.064vw;
    bottom: 0;
    left: 0;
    // border-left: 10px solid #0175dc;
    // border-bottom: 10px solid #0175dc;
    // border-top: 10px solid transparent;
    // border-right: 10px solid transparent;
    border-left: 0.532vw solid transparent;
    border-bottom: .6vw solid #0175dc;
    border-top: 0.532vw solid transparent;
    border-right: 0.532vw solid transparent;
  }

  .corner.br {
    bottom: 0;
    right: 0;
    // width: 20px;
    // height: 20px;
    width: 1.064vw;
    height: 1.064vw;
    border-left: 0.532vw solid transparent;
    border-bottom: 0.532vw solid #0175dc;
    border-top: 0.532vw solid transparent;
    border-right: 0.532vw solid #0175dc;
    // border-left: 10px solid transparent;
    // border-bottom: 10px solid #0175dc;
    // border-top: 10px solid transparent;
    // border-right: 10px solid #0175dc;
    // transform: rotate(-90deg);

  }

  .gradient-to-right {
    background: linear-gradient(to right, #0c3f68cc, transparent);
  }

  .gradient-to-left {
    background: linear-gradient(to left, #0c3f68cc, transparent);
  }

  .body-gradient-to-right {
    background: linear-gradient(to right, #0003, transparent);
  }

  .body-gradient-to-left {
    background: linear-gradient(to left, #0003, transparent);
  }
}
</style>
