summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issue_show/components/pinned_links.vue
blob: a877aa2ac9616f216675f4814081126f3064174a (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
52
53
54
55
56
57
58
59
60
61
62
63
<script>
import { GlButton } from '@gitlab/ui';
import { STATUS_PAGE_PUBLISHED, JOIN_ZOOM_MEETING } from '../constants';

export default {
  components: {
    GlButton,
  },
  props: {
    zoomMeetingUrl: {
      type: String,
      required: false,
      default: '',
    },
    publishedIncidentUrl: {
      type: String,
      required: false,
      default: '',
    },
  },
  computed: {
    pinnedLinks() {
      return [
        {
          id: 'publishedIncidentUrl',
          url: this.publishedIncidentUrl,
          text: STATUS_PAGE_PUBLISHED,
          icon: 'tanuki',
        },
        {
          id: 'zoomMeetingUrl',
          url: this.zoomMeetingUrl,
          text: JOIN_ZOOM_MEETING,
          icon: 'brand-zoom',
        },
      ];
    },
  },
  methods: {
    needsPaddingClass(i) {
      return i < this.pinnedLinks.length - 1;
    },
  },
};
</script>

<template>
  <div class="border-bottom gl-mb-6 gl-display-flex gl-justify-content-start">
    <template v-for="(link, i) in pinnedLinks">
      <div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }">
        <gl-button
          :href="link.url"
          target="_blank"
          :icon="link.icon"
          size="small"
          class="gl-font-weight-bold gl-mb-5"
          :data-testid="link.id"
          >{{ link.text }}</gl-button
        >
      </div>
    </template>
  </div>
</template>