all files / src/components/FileContent/ index.vue

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                                                                                                 
<template>
  <div class="file-content">
    <Title class="file-title" @toggle-history="handleHistory" @toggle-diff="handleDiff" :openHistory="openHistory" :openDiff="openDiff" />
    <Content class="file-content" :openHistory="openHistory" :openDiff="openDiff" />
  </div>
</template>
 
<script>
import Title from './Title'
import Content from './Content'
 
export default {
  name: 'FileContent',
  components: {
    Title,
    Content
  },
  data () {
    return {
      openHistory: true,
      openDiff: true
    }
  },
  methods: {
    // toggle version history panel
    handleHistory () {
      this.openHistory = !this.openHistory
    },
 
    // toggle diff display
    handleDiff () {
      this.openDiff = !this.openDiff
    }
  }
}
</script>
 
<style lang="scss" scoped>
  .file-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    .file-title {
      flex: 0 0 50px;
    }
    .file-content {
      flex: 1;
    }
  }
</style>