docs/.vitepress/theme/components/Tooltip.vue

9cf555e0d1004701b0f9bdba559b0b245840b9f3
wotaku/docs/.vitepress/theme/components/Tooltip.vue

58 lines · 1493 bytes

 1<!--
 2  All Rights Reserved
 3
 4  Copyright (c) 2025 taskylizard
 5
 6  All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
 7-->
 8<script setup lang="ts">
 9withDefaults(
10  defineProps<{
11    title: string
12    icon: string
13  }>(),
14  {
15    title: 'Info',
16    // https://icon-sets.iconify.design/material-symbols/
17    icon: 'i-material-symbols-info-i'
18  }
19)
20</script>
21
22<template>
23  <VTooltip theme="vp-tooltip">
24    <button
25      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">
26      <div :class="icon" />
27    </button>
28
29    <template #popper>
30      <div class="border-$vp-c-divider bg-$vp-c-bg-alt b-rd-4 max-w-lg border-2 border-solid p-4 transition-all">
31        <h3 class="text-$vp-c-text-1 mb-2 text-lg font-semibold" v-text="title" />
32        <p class="text-$vp-c-text-2 text-sm content">
33          <slot />
34        </p>
35      </div>
36    </template>
37  </VTooltip>
38</template>
39
40<style>
41.v-popper__popper {
42  --uno: z-9999;
43}
44
45.v-popper {
46  display: inline-flex !important;
47}
48
49.v-popper__popper .content ol {
50  list-style: decimal !important;
51}
52
53.v-popper__popper .content ul {
54  --uno: ml-4;
55  color: var(--vp-c-text-2);
56  list-style: disc !important;
57}
58</style>