summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/dismissible_alert.vue
blob: 8494f99fd7d04a9af7d110ec544642a9d90fc76e (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
<script>
/* eslint-disable vue/no-v-html */
import { GlAlert } from '@gitlab/ui';

export default {
  components: {
    GlAlert,
  },
  props: {
    html: {
      type: String,
      required: false,
      default: '',
    },
  },
  data() {
    return {
      isDismissed: false,
    };
  },
  methods: {
    dismiss() {
      this.isDismissed = true;
    },
  },
};
</script>

<template>
  <gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
    <div v-html="html"></div>
  </gl-alert>
</template>