aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/StudipTooltipIcon.vue
blob: 30d203345224287ded158beeb5353ade4632dc26 (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
40
41
42
43
44
45
46
<template>
    <span data-tooltip class="tooltip tooltip-icon" :class="cssClass" :title="title" tabindex="0">
        <span class="tooltip-content" v-if="isHtml" v-html="text"></span>
        <studip-icon shape="info-circle" role="inactive" :size="size"></studip-icon>
    </span>
</template>

<script>
    export default {
        name: 'studip-tooltip-icon',
        props: {
            text: String,
            isHtml: {
                type: Boolean,
                required: false,
                default: false
            },
            isImportant: {
                type: Boolean,
                required: false,
                default: false
            },
            size: {
                type: Number,
                default: 16
            }
        },
        computed: {
            cssClass () {
                return this.isImportant ? 'tooltip-important' : '';
            },
            title () {
                return !this.isHtml ? this.text : '';
            }
        }
    }
</script>

<style lang="scss" scoped>
.tooltip img {
    vertical-align: text-bottom;
}
.tooltip.tooltip-icon::before {
    display: none;
}
</style>