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

39 lines
911 B
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
2021-04-29 21:17:54 +05:30
import { GlButton, GlPopover, GlSafeHtmlDirective } from '@gitlab/ui';
2018-11-18 11:00:15 +05:30
/**
* Render a button with a question mark icon
* On hover shows a popover. The popover will be dismissed on mouseleave
*/
export default {
name: 'HelpPopover',
components: {
2021-02-22 17:27:13 +05:30
GlButton,
2021-03-11 19:13:27 +05:30
GlPopover,
2018-11-18 11:00:15 +05:30
},
2021-04-29 21:17:54 +05:30
directives: {
SafeHtml: GlSafeHtmlDirective,
},
2018-11-18 11:00:15 +05:30
props: {
options: {
type: Object,
required: false,
default: () => ({}),
},
},
};
</script>
<template>
2021-03-11 19:13:27 +05:30
<span>
2021-04-29 21:17:54 +05:30
<gl-button ref="popoverTrigger" variant="link" icon="question" :aria-label="__('Help')" />
<gl-popover :target="() => $refs.popoverTrigger.$el" v-bind="options">
<template v-if="options.title" #title>
<span v-safe-html="options.title"></span>
2021-03-11 19:13:27 +05:30
</template>
<template #default>
2021-04-29 21:17:54 +05:30
<div v-safe-html="options.content"></div>
2021-03-11 19:13:27 +05:30
</template>
</gl-popover>
</span>
2018-11-18 11:00:15 +05:30
</template>