2018-07-13 10:52:08 -04:00
|
|
|
<script>
|
2021-01-28 16:09:04 -05:00
|
|
|
import { GlButton, GlPopover } from '@gitlab/ui';
|
2018-07-13 10:52:08 -04:00
|
|
|
|
2018-08-03 11:14:05 -04:00
|
|
|
/**
|
|
|
|
* Render a button with a question mark icon
|
|
|
|
* On hover shows a popover. The popover will be dismissed on mouseleave
|
|
|
|
*/
|
2018-07-13 10:52:08 -04:00
|
|
|
export default {
|
2018-08-03 11:14:05 -04:00
|
|
|
name: 'HelpPopover',
|
2018-07-13 10:52:08 -04:00
|
|
|
components: {
|
2020-12-15 07:10:17 -05:00
|
|
|
GlButton,
|
2021-01-28 16:09:04 -05:00
|
|
|
GlPopover,
|
2018-07-13 10:52:08 -04:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
options: {
|
|
|
|
type: Object,
|
2018-08-03 11:14:05 -04:00
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
2018-07-13 10:52:08 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2021-01-28 16:09:04 -05:00
|
|
|
<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-07-13 10:52:08 -04:00
|
|
|
</template>
|