<template>
  <div>
    <td class="line-number-cell">
      <v-btn
        block
        class="line-number-btn"
        flat
        @click="toggleEditor"
      >
        {{ lineNo }}
      </v-btn>
    </td>
    <td class="code-cell-content pl-2">
        <span v-html="code" class="code-line"></span>
      <slot/>
    </td>
  </div>
</template>

<script>
  export default {
    name: 'submission-line',
    props: {
      lineNo: {
        type: String,
        required: true
      },
      code: {
        type: String,
        required: true
      },
      codeLanguage: {
        type: String,
        default: 'lang-c'
      }
    },
    methods: {
      toggleEditor () {
        this.$emit('toggleEditor')
      }
    }
  }
</script>

<style scoped>
  .line-number-cell {
    vertical-align: top;
  }

  .code-cell-content {
    width: 100%;
  }

  .code-line {
    white-space: pre-wrap;
    font-family: monospace;
  }


  .line-number-btn {
    height: fit-content;
    min-width: 50px;
    margin: 0;
  }
</style>