Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sticky_header.vue « components « show « issues « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 738bb2c2aa0fb9f7f6dd172bdd7412d6de00c59a (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<script>
import { GlBadge, GlIcon, GlIntersectionObserver, GlLink } from '@gitlab/ui';
import HiddenBadge from '~/issuable/components/hidden_badge.vue';
import LockedBadge from '~/issuable/components/locked_badge.vue';
import {
  issuableStatusText,
  STATUS_CLOSED,
  TYPE_EPIC,
  WORKSPACE_PROJECT,
} from '~/issues/constants';
import ConfidentialityBadge from '~/vue_shared/components/confidentiality_badge.vue';

export default {
  WORKSPACE_PROJECT,
  components: {
    ConfidentialityBadge,
    GlBadge,
    GlIcon,
    GlIntersectionObserver,
    GlLink,
    HiddenBadge,
    LockedBadge,
  },
  props: {
    isConfidential: {
      type: Boolean,
      required: false,
      default: false,
    },
    isHidden: {
      type: Boolean,
      required: false,
      default: false,
    },
    isLocked: {
      type: Boolean,
      required: false,
      default: false,
    },
    issuableStatus: {
      type: String,
      required: true,
    },
    issuableType: {
      type: String,
      required: true,
    },
    show: {
      type: Boolean,
      required: false,
      default: false,
    },
    title: {
      type: String,
      required: true,
    },
  },
  computed: {
    isClosed() {
      return this.issuableStatus === STATUS_CLOSED;
    },
    statusIcon() {
      if (this.issuableType === TYPE_EPIC) {
        return this.isClosed ? 'epic-closed' : 'epic';
      }
      return this.isClosed ? 'issue-closed' : 'issues';
    },
    statusText() {
      return issuableStatusText[this.issuableStatus];
    },
    statusVariant() {
      return this.isClosed ? 'info' : 'success';
    },
  },
};
</script>

<template>
  <gl-intersection-observer @appear="$emit('hide')" @disappear="$emit('show')">
    <transition name="issuable-header-slide">
      <div
        v-if="show"
        class="issue-sticky-header gl-fixed gl-z-index-3 gl-bg-white gl-border-1 gl-border-b-solid gl-border-b-gray-100 gl-py-3"
        data-testid="issue-sticky-header"
      >
        <div
          class="issue-sticky-header-text gl-display-flex gl-align-items-center gl-gap-2 gl-mx-auto gl-px-5"
        >
          <gl-badge :variant="statusVariant">
            <gl-icon :name="statusIcon" />
            <span class="gl-display-none gl-sm-display-block gl-ml-2">{{ statusText }}</span>
          </gl-badge>
          <confidentiality-badge
            v-if="isConfidential"
            :issuable-type="issuableType"
            :workspace-type="$options.WORKSPACE_PROJECT"
          />
          <locked-badge v-if="isLocked" :issuable-type="issuableType" />
          <hidden-badge v-if="isHidden" :issuable-type="issuableType" />
          <gl-link
            class="gl-font-weight-bold gl-text-black-normal gl-text-truncate"
            href="#top"
            :title="title"
          >
            {{ title }}
          </gl-link>
        </div>
      </div>
    </transition>
  </gl-intersection-observer>
</template>