debian-mirror-gitlab/app/assets/javascripts/whats_new/components/feature.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

94 lines
2.4 KiB
Vue
Raw Normal View History

2021-02-22 17:27:13 +05:30
<script>
2021-06-08 01:23:25 +05:30
import { GlBadge, GlIcon, GlLink, GlSafeHtmlDirective, GlButton } from '@gitlab/ui';
import { dateInWords, isValidDate } from '~/lib/utils/datetime_utility';
2021-02-22 17:27:13 +05:30
export default {
components: {
GlBadge,
GlIcon,
GlLink,
2021-06-08 01:23:25 +05:30
GlButton,
2021-02-22 17:27:13 +05:30
},
directives: {
SafeHtml: GlSafeHtmlDirective,
},
props: {
feature: {
type: Object,
required: true,
},
},
2021-06-08 01:23:25 +05:30
computed: {
releaseDate() {
const { published_at } = this.feature;
const date = new Date(published_at);
if (!isValidDate(date) || date.getTime() === 0) {
return '';
}
return dateInWords(date);
},
},
2021-09-04 01:27:46 +05:30
safeHtmlConfig: { ADD_ATTR: ['target'] },
2021-02-22 17:27:13 +05:30
};
</script>
<template>
2021-06-08 01:23:25 +05:30
<div class="gl-py-6 gl-px-6 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100">
<gl-link
2022-07-16 23:28:13 +05:30
v-if="feature.image_url"
2021-06-08 01:23:25 +05:30
:href="feature.url"
target="_blank"
class="gl-display-block"
2022-07-16 23:28:13 +05:30
data-testid="whats-new-image-link"
2021-11-11 11:23:49 +05:30
data-track-action="click_whats_new_item"
2021-06-08 01:23:25 +05:30
:data-track-label="feature.title"
:data-track-property="feature.url"
>
<div
class="whats-new-item-image gl-bg-size-cover"
:style="`background-image: url(${feature.image_url});`"
>
<span class="gl-sr-only">{{ feature.title }}</span>
</div>
</gl-link>
2021-02-22 17:27:13 +05:30
<gl-link
:href="feature.url"
target="_blank"
2021-06-08 01:23:25 +05:30
class="whats-new-item-title-link gl-display-block gl-mt-4 gl-mb-1"
2021-11-11 11:23:49 +05:30
data-track-action="click_whats_new_item"
2021-02-22 17:27:13 +05:30
:data-track-label="feature.title"
:data-track-property="feature.url"
>
2021-06-08 01:23:25 +05:30
<h5 class="gl-font-lg gl-my-0" data-test-id="feature-title">{{ feature.title }}</h5>
2021-02-22 17:27:13 +05:30
</gl-link>
2021-06-08 01:23:25 +05:30
<div v-if="releaseDate" class="gl-mb-3" data-testid="release-date">{{ releaseDate }}</div>
2021-02-22 17:27:13 +05:30
<div v-if="feature.packages" class="gl-mb-3">
<gl-badge
v-for="packageName in feature.packages"
:key="packageName"
2021-06-08 01:23:25 +05:30
size="md"
2022-07-16 23:28:13 +05:30
variant="tier"
icon="license"
class="gl-mr-2"
2021-02-22 17:27:13 +05:30
>
2022-07-16 23:28:13 +05:30
{{ packageName }}
2021-02-22 17:27:13 +05:30
</gl-badge>
</div>
2021-09-04 01:27:46 +05:30
<div
v-safe-html:[$options.safeHtmlConfig]="feature.body"
class="gl-pt-3 gl-line-height-20"
></div>
2021-06-08 01:23:25 +05:30
<gl-button
2021-02-22 17:27:13 +05:30
:href="feature.url"
target="_blank"
2021-11-11 11:23:49 +05:30
data-track-action="click_whats_new_item"
2021-02-22 17:27:13 +05:30
:data-track-label="feature.title"
:data-track-property="feature.url"
>
2021-06-08 01:23:25 +05:30
{{ __('Learn more') }} <gl-icon name="arrow-right" />
</gl-button>
2021-02-22 17:27:13 +05:30
</div>
</template>