diff options
Diffstat (limited to 'app/assets/javascripts/repository/components/directory_download_links.vue')
-rw-r--r-- | app/assets/javascripts/repository/components/directory_download_links.vue | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/assets/javascripts/repository/components/directory_download_links.vue b/app/assets/javascripts/repository/components/directory_download_links.vue new file mode 100644 index 00000000000..dffadade082 --- /dev/null +++ b/app/assets/javascripts/repository/components/directory_download_links.vue @@ -0,0 +1,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> |