debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/dismissible_container.vue

55 lines
1.1 KiB
Vue
Raw Normal View History

2020-10-24 23:57:45 +05:30
<script>
import { GlIcon } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
export default {
components: {
GlIcon,
},
props: {
path: {
type: String,
required: true,
},
featureId: {
type: String,
required: true,
},
},
methods: {
dismiss() {
axios
.post(this.path, {
feature_name: this.featureId,
})
2021-03-08 18:12:59 +05:30
.catch((e) => {
2020-10-24 23:57:45 +05:30
// eslint-disable-next-line @gitlab/require-i18n-strings, no-console
console.error('Failed to dismiss message.', e);
});
this.$emit('dismiss');
},
},
};
</script>
<template>
<div>
<div class="gl-display-flex gl-align-items-center">
<slot name="title"></slot>
<div class="ml-auto">
<button
:aria-label="__('Close')"
class="btn-blank"
type="button"
data-testid="close"
@click="dismiss"
>
2021-02-22 17:27:13 +05:30
<gl-icon name="close" class="gl-text-gray-500" />
2020-10-24 23:57:45 +05:30
</button>
</div>
</div>
<slot></slot>
</div>
</template>