docs/.vitepress/theme/components/LinkInline.vue

b574660d5663cb8e400a89fc661ce3886c334ec9
wotaku/docs/.vitepress/theme/components/LinkInline.vue history · blame · raw

40 lines · 908 bytes

 1<script setup lang="ts">
 2import { Tooltip } from 'floating-vue'
 3import { withBase } from 'vitepress'
 4
 5defineProps<{
 6  title: string
 7  link: string
 8  target?: string
 9  description: string
10}>()
11</script>
12
13<template>
14  <span class="sr-only">{{ title }}</span>
15  <ClientOnly>
16    <Tooltip class="inline-block" theme="twoslash">
17      <a
18        :href="withBase(link)"
19        :target
20        class="bg-$vp-c-default-soft hover:bg-$vp-c-brand-soft/25 rounded px2 py1 decoration-none!"
21      >
22        {{ title }}
23      </a>
24
25      <template #popper>
26        <a :href="withBase(link)" :target flex flex-col p4 gap-2 max-w-100>
27          <div flex gap-2>
28            <div>
29              {{ title }}
30            </div>
31            <div flex-grow />
32          </div>
33          <div op75 text-sm>
34            {{ description }}
35          </div>
36        </a>
37      </template>
38    </Tooltip>
39  </ClientOnly>
40</template>