<template>
  <div class="module">
    <div class="module-top">
      <span class="title">{{ componentNameList[type] }}</span>
      <div class="module-icon">
        <span><SvgIcon icon-class="copy" size="10" /></span>
        <span class="active"><SvgIcon icon-class="setup" size="10" /></span>
        <span><SvgIcon icon-class="delete" size="10" /></span>
      </div>
    </div>
    <div class="module-content">
      <slot name="content"></slot>
    </div>
  </div>
</template>

<script>
import { componentNameList } from '@/views/book/courseware/data/bookType.js';

export default {
  name: 'ModuleBase',
  props: {
    type: {
      type: String,
      default: 'text',
    },
  },
  data() {
    return {
      isShow: false,
      componentNameList,
    };
  },
};
</script>

<style lang="scss" scoped>
.module {
  padding: 8px;
  border: 1px solid #5a5a5a;

  &-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;

    .title {
      font-size: 12px;
      color: $label-color;
    }
  }

  &-icon {
    display: flex;
    column-gap: 8px;

    span {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 16px;
      height: 16px;
      cursor: pointer;
      background-color: #fff;
      border-radius: 20px;

      &.active {
        background-color: #c9c9c9;
      }
    }
  }

  &-content {
    padding: 8px;
    background-color: #fff;
  }
}
</style>
