-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathInfoTooltip.vue
More file actions
59 lines (57 loc) · 1.23 KB
/
Copy pathInfoTooltip.vue
File metadata and controls
59 lines (57 loc) · 1.23 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
<!--
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcButton
v-tooltip="{ content: text, triggers: ['hover'], delay: 50, placement: placement, autoHide: true }"
type="tertiary"
:aria-label="text">
<template #icon>
<component :is="iconComponent" :fill-color="iconColor" :size="20" />
</template>
</NcButton>
</template>
<script>
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
import Warning from 'vue-material-design-icons/AlertOutline.vue'
import Information from 'vue-material-design-icons/InformationOutline.vue'
export default {
name: 'InfoTooltip',
components: {
NcButton,
Information,
Warning,
},
directives: {
tooltip: Tooltip,
},
props: {
text: {
type: String,
required: true,
},
placement: {
type: String,
default: 'top',
},
type: {
type: String,
default: 'info',
},
},
data() {
return {
}
},
computed: {
iconComponent() {
return this.type === 'warning' ? Warning : Information
},
iconColor() {
return this.type === 'warning' ? 'var(--color-warning)' : 'var(--color-primary)'
},
},
}
</script>