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

38 lines
926 B
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
2021-03-11 19:13:27 +05:30
import { GlButton, GlPopover } 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
},
props: {
options: {
type: Object,
required: false,
default: () => ({}),
},
},
};
</script>
<template>
2021-03-11 19:13:27 +05:30
<span>
<gl-button ref="popoverTrigger" variant="link" icon="question" tabindex="0" />
<gl-popover triggers="hover focus" :target="() => $refs.popoverTrigger.$el" v-bind="options">
<template #title>
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="options.title"></span>
</template>
<template #default>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="options.content"></div>
</template>
</gl-popover>
</span>
2018-11-18 11:00:15 +05:30
</template>