Commit e48dee0f01

e48dee0f019b58e2d91ddfaf29337ba6e8f97a41

parent: 0756b669d4

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-11-06 14:25 UTC

mini

Layout: unified · split

docs/.vitepress/theme/components/link-card/Card.vue +51 −7
@@ -1,12 +1,23 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { computed, inject, ref } from 'vue'
3import { DECK_MINI_KEY } from './deck'
2import { renderCardIcon } from './iconMarkup' 4import { renderCardIcon } from './iconMarkup'
3 5
4const props = defineProps<{ 6const props = withDefaults(
5 href: string 7 defineProps<{
6 title: string 8 href: string
7 icon?: string 9 title: string
8 download?: boolean 10 icon?: string
9}>() 11 download?: boolean
12 mini?: boolean
13 }>(),
14 {
15 mini: undefined
16 }
17)
18
19const deckMini = inject(DECK_MINI_KEY, ref(false))
20const isMini = computed(() => props.mini ?? deckMini.value)
10</script> 21</script>
11 22
12<template> 23<template>
@@ -15,10 +26,14 @@ const props = defineProps<{
15 :href="props.href" 26 :href="props.href"
16 :download="props.download ? '' : undefined" 27 :download="props.download ? '' : undefined"
17 class="vp-card" 28 class="vp-card"
29 :class="{ 'vp-card--mini': isMini }"
18 > 30 >
19 <article 31 <article
20 class="vp-card-container" 32 class="vp-card-container"
21 :class="{ 'vp-card-container--no-details': !$slots.default }" 33 :class="{
34 'vp-card-container--no-details': !$slots.default,
35 'vp-card-container--mini': isMini
36 }"
22 > 37 >
23 <div 38 <div
24 v-if="props.icon" 39 v-if="props.icon"
@@ -96,4 +111,33 @@ const props = defineProps<{
96 font-weight: 500; 111 font-weight: 500;
97 color: var(--vp-c-text-2); 112 color: var(--vp-c-text-2);
98} 113}
114
115.vp-card-container--mini {
116 flex-direction: row;
117 align-items: center;
118 gap: 12px;
119 padding: 12px 16px;
120}
121
122.vp-card-container--mini.vp-card-container--no-details {
123 justify-content: flex-start;
124}
125
126.vp-card--mini .vp-card-icon {
127 width: 32px;
128 height: 32px;
129 margin-bottom: 0;
130 font-size: 18px;
131 flex-shrink: 0;
132}
133
134.vp-card--mini .vp-card-title {
135 margin: 0;
136 font-size: 14px;
137 line-height: 1.3;
138}
139
140.vp-card--mini .vp-card-details {
141 display: none;
142}
99</style> 143</style>
docs/.vitepress/theme/components/link-card/Grid.vue +22 −2
@@ -1,5 +1,21 @@
1<script setup lang="ts">
2import { computed, provide } from 'vue'
3import { DECK_MINI_KEY } from './deck'
4
5const props = withDefaults(
6 defineProps<{
7 mini?: boolean
8 }>(),
9 {
10 mini: false
11 }
12)
13
14provide(DECK_MINI_KEY, computed(() => props.mini))
15</script>
16
1<template> 17<template>
2 <div class="vp-grid"> 18 <div class="vp-grid" :class="{ 'vp-grid--mini': mini }">
3 <slot /> 19 <slot />
4 </div> 20 </div>
5</template> 21</template>
@@ -11,6 +27,10 @@
11 gap: 8px; 27 gap: 8px;
12} 28}
13 29
30.vp-grid--mini {
31 grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
32}
33
14@media (min-width: 640px) { 34@media (min-width: 640px) {
15 .vp-grid { 35 .vp-grid {
16 gap: 8px; 36 gap: 8px;
@@ -22,4 +42,4 @@
22 gap: 8px; 42 gap: 8px;
23 } 43 }
24} 44}
25</style>\ No newline at end of file 45</style>
docs/.vitepress/theme/components/link-card/deck.ts added +5
@@ -0,0 +1,5 @@
1import type { InjectionKey, Ref } from 'vue'
2
3export const DECK_MINI_KEY: InjectionKey<Ref<boolean>> = Symbol(
4 'card-deck-mini'
5)
docs/nonen/index.md +3 −3
@@ -17,13 +17,13 @@ og:
17 17
18## Global 18## Global
19 19
20<Deck> 20<Deck mini>
21 <Card title="Multilingual" href="/nonen/multilingual" icon=":twemoji-globe-showing-asia-australia:" /> 21 <Card title="Multilingual" href="/nonen/multilingual" icon=":twemoji-globe-showing-asia-australia:" />
22</Deck> 22</Deck>
23 23
24## Asia 24## Asia
25 25
26<Deck> 26<Deck mini>
27 <Card title="Arabic" href="/nonen/arabic" icon=":twemoji-flag-united-arab-emirates:" /> 27 <Card title="Arabic" href="/nonen/arabic" icon=":twemoji-flag-united-arab-emirates:" />
28 <Card title="Chinese" href="/nonen/chinese" icon=":twemoji-flag-china:" /> 28 <Card title="Chinese" href="/nonen/chinese" icon=":twemoji-flag-china:" />
29 <Card title="Indian" href="/nonen/indian" icon=":twemoji-flag-india:" /> 29 <Card title="Indian" href="/nonen/indian" icon=":twemoji-flag-india:" />
@@ -36,7 +36,7 @@ og:
36 36
37## Europe 37## Europe
38 38
39<Deck> 39<Deck mini>
40 <Card title="Catalan" href="/nonen/catalan" icon=":twemoji-flag-spain:" /> 40 <Card title="Catalan" href="/nonen/catalan" icon=":twemoji-flag-spain:" />
41 <Card title="French" href="/nonen/french" icon=":twemoji-flag-france:" /> 41 <Card title="French" href="/nonen/french" icon=":twemoji-flag-france:" />
42 <Card title="German" href="/nonen/german" icon=":twemoji-flag-germany:" /> 42 <Card title="German" href="/nonen/german" icon=":twemoji-flag-germany:" />