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

feature.vue « components « whats_new « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c954a86e593620ef4948b1f8046c5f4aed4d2498 (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
<script>
import { GlBadge, GlIcon, GlLink, GlSafeHtmlDirective, GlButton } from '@gitlab/ui';
import { dateInWords, isValidDate } from '~/lib/utils/datetime_utility';

export default {
  components: {
    GlBadge,
    GlIcon,
    GlLink,
    GlButton,
  },
  directives: {
    SafeHtml: GlSafeHtmlDirective,
  },
  props: {
    feature: {
      type: Object,
      required: true,
    },
  },
  computed: {
    releaseDate() {
      const { published_at } = this.feature;
      const date = new Date(published_at);

      if (!isValidDate(date) || date.getTime() === 0) {
        return '';
      }

      return dateInWords(date);
    },
  },
};
</script>

<template>
  <div class="gl-py-6 gl-px-6 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100">
    <gl-link
      v-if="feature.image_url"
      :href="feature.documentation_link"
      target="_blank"
      class="gl-display-block"
      data-testid="whats-new-image-link"
      data-track-action="click_whats_new_item"
      :data-track-label="feature.name"
      :data-track-property="feature.documentation_link"
    >
      <div
        class="whats-new-item-image gl-bg-size-cover"
        :style="`background-image: url(${feature.image_url});`"
      >
        <span class="gl-sr-only">{{ feature.name }}</span>
      </div>
    </gl-link>
    <gl-link
      :href="feature.documentation_link"
      target="_blank"
      class="whats-new-item-title-link gl-display-block gl-mt-4 gl-mb-1"
      data-track-action="click_whats_new_item"
      :data-track-label="feature.name"
      :data-track-property="feature.documentation_link"
    >
      <h5 class="gl-font-lg gl-my-0" data-test-id="feature-name">{{ feature.name }}</h5>
    </gl-link>
    <div v-if="releaseDate" class="gl-mb-3" data-testid="release-date">{{ releaseDate }}</div>
    <div v-if="feature.available_in" class="gl-mb-3">
      <gl-badge
        v-for="packageName in feature.available_in"
        :key="packageName"
        size="md"
        variant="tier"
        icon="license"
        class="gl-mr-2"
      >
        {{ packageName }}
      </gl-badge>
    </div>
    <div
      v-safe-html:[$options.safeHtmlConfig]="feature.description"
      class="gl-pt-3 gl-line-height-20"
    ></div>
    <gl-button
      :href="feature.documentation_link"
      target="_blank"
      data-track-action="click_whats_new_item"
      :data-track-label="feature.name"
      :data-track-property="feature.documentation_link"
    >
      {{ __('Learn more') }} <gl-icon name="arrow-right" />
    </gl-button>
  </div>
</template>