summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/file_row_header.vue
blob: 301fd8116a94cf4ff8e5d4ecfde755ec06dbf4a7 (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
<script>
import { truncatePathMiddleToLength } from '~/lib/utils/text_utility';

const MAX_PATH_LENGTH = 40;

export default {
  props: {
    path: {
      type: String,
      required: true,
    },
  },
  computed: {
    truncatedPath() {
      return truncatePathMiddleToLength(this.path, MAX_PATH_LENGTH);
    },
  },
};
</script>

<template>
  <div class="file-row-header bg-white sticky-top p-2 js-file-row-header">
    <span class="bold">{{ truncatedPath }}</span>
  </div>
</template>