docs/.vitepress/theme/components/Tooltip.vue
71 lines · 1783 bytes
1<!--
2 Copyright (c) 2024 taskylizard
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15-->
16<script setup lang="ts">
17withDefaults(
18 defineProps<{
19 title: string
20 icon: string
21 }>(),
22 {
23 title: 'Info',
24 icon: 'i-material-symbols-info-i'
25 }
26)
27</script>
28
29<template>
30 <VTooltip theme="vp-tooltip">
31 <button
32 class="bg-$vp-c-default-soft hover:bg-$vp-c-default-soft/40 text-primary border-$vp-c-default-soft hover:border-primary ml-2 size-7 select-none rounded rounded-full border-2 border-solid font-bold transition-all duration-300"
33 >
34 <div :class="icon" />
35 </button>
36
37 <template #popper>
38 <div
39 class="border-$vp-c-divider bg-$vp-c-bg-alt b-rd-4 max-w-lg border-2 border-solid p-4 transition-all"
40 >
41 <h3
42 class="text-$vp-c-text-1 mb-2 text-lg font-semibold"
43 v-text="title"
44 />
45 <p class="text-$vp-c-text-2 text-sm content">
46 <slot />
47 </p>
48 </div>
49 </template>
50 </VTooltip>
51</template>
52
53<style>
54.v-popper__popper {
55 --uno: z-9999;
56}
57
58.v-popper {
59 display: inline-flex !important;
60}
61
62.v-popper__popper .content ol {
63 list-style: decimal !important;
64}
65
66.v-popper__popper .content ul {
67 --uno: ml-4;
68 color: var(--vp-c-text-2);
69 list-style: disc !important;
70}
71</style>