summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/components/directory_download_links.vue
blob: 8c029fc99730d436619c01830691596c6be9b895 (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
<script>
import { GlLink } from '@gitlab/ui';

export default {
  components: {
    GlLink,
  },
  props: {
    currentPath: {
      type: String,
      required: false,
      default: null,
    },
    links: {
      type: Array,
      required: true,
    },
  },
  computed: {
    normalizedLinks() {
      return this.links.map((link) => ({
        text: link.text,
        path: `${link.path}?path=${this.currentPath}`,
      }));
    },
  },
};
</script>

<template>
  <section class="border-top pt-1 mt-1">
    <h5 class="m-0 dropdown-bold-header">{{ __('Download this directory') }}</h5>
    <div class="dropdown-menu-content">
      <div class="btn-group ml-0 w-100">
        <gl-link
          v-for="(link, index) in normalizedLinks"
          :key="index"
          :href="link.path"
          :class="{ 'btn-primary': index === 0 }"
          class="btn btn-xs"
        >
          {{ link.text }}
        </gl-link>
      </div>
    </div>
  </section>
</template>