docs/.vitepress/theme/components/Tooltip.vue
72 lines · 1832 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 // https://icon-sets.iconify.design/material-symbols/
25 icon: "i-material-symbols-info-i",
26 },
27);
28</script>
29
30<template>
31 <VTooltip theme="vp-tooltip">
32 <button
33 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"
34 >
35 <div :class="icon" />
36 </button>
37
38 <template #popper>
39 <div
40 class="border-$vp-c-divider bg-$vp-c-bg-alt b-rd-4 max-w-lg border-2 border-solid p-4 transition-all"
41 >
42 <h3
43 class="text-$vp-c-text-1 mb-2 text-lg font-semibold"
44 v-text="title"
45 />
46 <p class="text-$vp-c-text-2 text-sm content">
47 <slot />
48 </p>
49 </div>
50 </template>
51 </VTooltip>
52</template>
53
54<style>
55.v-popper__popper {
56 --uno: z-9999;
57}
58
59.v-popper {
60 display: inline-flex !important;
61}
62
63.v-popper__popper .content ol {
64 list-style: decimal !important;
65}
66
67.v-popper__popper .content ul {
68 --uno: ml-4;
69 color: var(--vp-c-text-2);
70 list-style: disc !important;
71}
72</style>