<template>
  <div class="grid-container">
    <el-button
      v-for="{ value } in serialNumberPositionList"
      :key="value"
      :class="[value, { active: value === position }]"
      :style="{ gridArea: value }"
      @click="$emit('changeNumberPosition', value)"
    />
    <div class="main"></div>
  </div>
</template>

<script>
import { serialNumberPositionList } from '@/views/book/courseware/data/common';

export default {
  name: 'SerialNumberPosition',
  props: {
    position: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      serialNumberPositionList,
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.grid-container {
  display: grid;
  grid-template-areas:
    '. top-start top top-end .'
    'left-start main main main right-start'
    'left main main main right'
    'left-end main main main right-end'
    '. bottom-start bottom bottom-end .';
  place-items: center center;
  width: 134px;
  height: 80px;
  padding: 8px;
  line-height: 10px;
  border: 1px solid #ebebeb;

  .el-button {
    width: 16px;
    height: 8px;
    padding: 0;
    margin: 0;
    border: 1px solid #e4e4e4;
    border-radius: 2px;

    &.active {
      background-color: #4176ff;
    }
  }

  .main {
    grid-area: main;
    width: 64px;
    height: 32px;
    background-color: #f8f8f8;
    border: 1px solid #e4e4e4;
    border-radius: 2px;
  }
}
</style>
