<template>
  <div class="panel">
    <div class="left">
      <div class="title">{{ currentTab }}</div>
      <div class="left-content">
        <AddNote v-if="currentTab == '插入笔记'" />
        <AutoCheck v-if="currentTab == '自动检查'" />
        <AutoClose v-if="currentTab == '自动补全'" />
      </div>
    </div>
    <div class="right">
      <div class="tabs">
        <div
          @click="handleClickTab(item)"
          :class="{ 'tab-item': true, active: currentTab == item }"
          v-for="(item, index) in tabs"
          :key="index"
        >
          {{ item }}
        </div>
      </div>
    </div>
    <div class="close">
      <i class="el-icon-close"></i>
    </div>
  </div>
</template>

<script>
import AddNote from "./addNote.vue";
import AutoCheck from "./autoCheck.vue";
import AutoClose from "./autoClose.vue";
export default {
  name: "rightPanel",
  components: {
    AddNote,
    AutoCheck,
    AutoClose,
  },
  data() {
    return {
      // 当前选中的tab
      currentTab: "插入笔记",
      //右侧tabs
      tabs: ["插入笔记", "自动检查", "自动补全"],
    };
  },
  methods: {
    handleClickTab(tab) {
      this.currentTab = tab;
    },
  },
};
</script>

<style lang="scss" scoped>
.panel {
  display: flex;
  padding: 40px 0 20px;
  position: relative;

  .left {
    padding-right: 16px;
    .title {
      font-weight: bold;
      display: flex;
      justify-content: center;
      margin-bottom: 16px;
    }
    .left-content {
    }
  }
  .right {
    margin-top: 20px;
    width: 66px;
    .tabs {
      .tab-item {
        text-align: center;
        padding: 14px;
        background-color: #eee;
        color: #666;
        cursor: pointer;
        transition: all ease 0.3s;
        &:hover {
          background-color: $theme-blue;
          color: #fff;
        }
      }
      .active {
        background-color: $theme-blue;
        color: #fff;
      }
    }
  }
  .close {
    position: absolute;
    right: 20px;
    top: 20px;
    i {
      font-size: 24px;
    }
  }
}
</style>
