summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/download_diff_viewer.vue
blob: 40ae9ed6c02347380c2b5b72b211f5e4191753d2 (plain)
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
<script>
import DownloadViewer from '../../content_viewer/viewers/download_viewer.vue';
import { diffModes } from '../constants';

export default {
  components: {
    DownloadViewer,
  },
  props: {
    diffMode: {
      type: String,
      required: true,
    },
    newPath: {
      type: String,
      required: true,
    },
    oldPath: {
      type: String,
      required: true,
    },
    projectPath: {
      type: String,
      required: false,
      default: '',
    },
  },
  diffModes,
};
</script>

<template>
  <div class="diff-file-container">
    <div class="diff-viewer">
      <div v-if="diffMode === $options.diffModes.replaced" class="two-up view row">
        <div class="col-sm-6 deleted">
          <download-viewer :path="oldPath" :project-path="projectPath" />
        </div>
        <div class="col-sm-6 added">
          <download-viewer :path="newPath" :project-path="projectPath" />
        </div>
      </div>
      <div v-else-if="diffMode === $options.diffModes.new" class="added">
        <download-viewer :path="newPath" :project-path="projectPath" />
      </div>
      <div v-else class="deleted">
        <download-viewer :path="oldPath" :project-path="projectPath" />
      </div>
    </div>
  </div>
</template>