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

74 lines
1.8 KiB
Vue
Raw Normal View History

2020-10-24 23:57:45 +05:30
<script>
import { mapState, mapActions } from 'vuex';
2020-11-24 15:15:51 +05:30
import { GlDrawer, GlBadge, GlIcon, GlLink } from '@gitlab/ui';
2020-10-24 23:57:45 +05:30
export default {
components: {
GlDrawer,
2020-11-24 15:15:51 +05:30
GlBadge,
GlIcon,
GlLink,
},
props: {
features: {
type: String,
required: false,
default: null,
},
2020-10-24 23:57:45 +05:30
},
computed: {
...mapState(['open']),
2020-11-24 15:15:51 +05:30
parsedFeatures() {
let features;
try {
features = JSON.parse(this.$props.features) || [];
} catch (err) {
features = [];
}
return features;
},
},
mounted() {
this.openDrawer();
2020-10-24 23:57:45 +05:30
},
methods: {
2020-11-24 15:15:51 +05:30
...mapActions(['openDrawer', 'closeDrawer']),
2020-10-24 23:57:45 +05:30
},
};
</script>
<template>
<div>
<gl-drawer class="mt-6" :open="open" @close="closeDrawer">
<template #header>
2020-11-24 15:15:51 +05:30
<h4 class="page-title my-2">{{ __("What's new at GitLab") }}</h4>
2020-10-24 23:57:45 +05:30
</template>
2020-11-24 15:15:51 +05:30
<div class="pb-6">
<div v-for="feature in parsedFeatures" :key="feature.title" class="mb-6">
<gl-link :href="feature.url" target="_blank">
<h5 class="gl-font-base">{{ feature.title }}</h5>
</gl-link>
<div class="mb-2">
<template v-for="package_name in feature.packages">
<gl-badge :key="package_name" size="sm" class="whats-new-item-badge mr-1">
<gl-icon name="license" />{{ package_name }}
</gl-badge>
</template>
</div>
<gl-link :href="feature.url" target="_blank">
<img
:alt="feature.title"
:src="feature.image_url"
class="img-thumbnail px-6 py-2 whats-new-item-image"
/>
</gl-link>
<p class="pt-2">{{ feature.body }}</p>
<gl-link :href="feature.url" target="_blank">{{ __('Learn more') }}</gl-link>
</div>
</div>
2020-10-24 23:57:45 +05:30
</gl-drawer>
</div>
</template>