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

1181c28da7f00dffc07621ad877fea1f9578faee
wotaku/docs/.vitepress/theme/components/LinkInline.vue

37 lines · 885 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 :href="withBase(link)" :target
18        class="bg-$vp-c-default-soft hover:bg-$vp-c-brand-soft/25 rounded px2 py1 decoration-none!">
19        {{ title }}
20      </a>
21
22      <template #popper>
23        <a :href="withBase(link)" :target flex flex-col p4 gap-2 max-w-100>
24          <div flex gap-2>
25            <div>
26              {{ title }}
27            </div>
28            <div flex-grow />
29          </div>
30          <div op75 text-sm>
31            {{ description }}
32          </div>
33        </a>
34      </template>
35    </Tooltip>
36  </ClientOnly>
37</template>