返回 slidev
FeaturesOverview.vue
根目录 / docs / .vitepress / theme / components / FeaturesOverview.vue
1 <script setup lang="ts">
2 import type { Feature } from '../../../features/index.data'
3 import { withBase } from 'vitepress'
4
5 defineProps<{
6 features: Feature[]
7 }>()
8 </script>
9
10 <template>
11 <div class="features-grid mt-4">
12 <a
13 v-for="feature in features"
14 :key="feature.name"
15 flex flex-col h-full p4 gap-3 rounded-md
16 :href="withBase(feature.link)"
17 >
18 <div font-bold text-wrap leading-5> {{ feature.title }} </div>
19 <div text-wrap leading-5 op-75 overflow-hidden text-sm> {{ feature.description }} </div>
20 <div flex-grow />
21 <div flex gap-1 pointer-events-auto>
22 <FeatureTag v-for="tag in feature.tags" :key="tag" :tag />
23 </div>
24 </a>
25 </div>
26 </template>
27
28 <style scoped>
29 .features-grid {
30 display: grid;
31 grid-gap: 0.75rem;
32 grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
33 }
34
35 .features-grid > a {
36 color: var(--vp-c-text-1);
37 text-decoration: none;
38 transition:
39 background-color 0.25s,
40 color 0.25s;
41 background-color: var(--vp-c-bg-soft);
42 }
43
44 .features-grid > a:hover {
45 color: var(--vp-c-brand-1);
46 background-color: var(--vp-c-default-soft);
47 }
48 </style>
49
49 lines Plain Text