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

docs_banner.vue « components « shared « frontend « content - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3748bf8ef7855b61112d7f8c13ec607f2dedf9d2 (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
<script>
export default {
  props: {
    text: {
      type: String,
      required: false,
      default: '',
    },
    show: {
      type: Boolean,
      required: false,
      default: true,
    },
  },
  data() {
    return {
      isVisible: this.show,
    };
  },
  mounted() {
    this.toggleBanner(this.isVisible);
  },
  methods: {
    toggleBanner(isVisible) {
      this.$emit('toggle', isVisible);
      this.isVisible = isVisible;
    },
  },
};
</script>

<template>
  <div v-if="isVisible" class="banner position-fixed w-100 text-center">
    <span v-if="text">{{ text }}</span>
    <slot></slot>
    <!-- TODO: Replace the 'x' below with a gl-icon component once gitlab-ui becomes available in the docs -->
    <button class="btn btn-close pull-right" @click="toggleBanner(false)">x</button>
  </div>
</template>