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 | 1 | <script setup lang="ts"> |
| 2 | import { computed, inject, ref } from 'vue' |
| 3 | import { DECK_MINI_KEY } from './deck' |
| 2 | 4 | import { renderCardIcon } from './iconMarkup' |
| 3 | 5 | |
| 4 | | const props = defineProps<{ |
| 5 | | href: string |
| 6 | | title: string |
| 7 | | icon?: string |
| 8 | | download?: boolean |
| 9 | | }>() |
| 6 | const props = withDefaults( |
| 7 | defineProps<{ |
| 8 | href: string |
| 9 | title: string |
| 10 | icon?: string |
| 11 | download?: boolean |
| 12 | mini?: boolean |
| 13 | }>(), |
| 14 | { |
| 15 | mini: undefined |
| 16 | } |
| 17 | ) |
| 18 | |
| 19 | const deckMini = inject(DECK_MINI_KEY, ref(false)) |
| 20 | const isMini = computed(() => props.mini ?? deckMini.value) |
| 10 | 21 | </script> |
| 11 | 22 | |
| 12 | 23 | <template> |
| @@ -15,10 +26,14 @@ const props = defineProps<{ |
| 15 | 26 | :href="props.href" |
| 16 | 27 | :download="props.download ? '' : undefined" |
| 17 | 28 | class="vp-card" |
| 29 | :class="{ 'vp-card--mini': isMini }" |
| 18 | 30 | > |
| 19 | 31 | <article |
| 20 | 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 | 38 | <div |
| 24 | 39 | v-if="props.icon" |
| @@ -96,4 +111,33 @@ const props = defineProps<{ |
| 96 | 111 | font-weight: 500; |
| 97 | 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 | 143 | </style> |
docs/.vitepress/theme/components/link-card/Grid.vue
+22 −2
| @@ -1,5 +1,21 @@ |
| 1 | <script setup lang="ts"> |
| 2 | import { computed, provide } from 'vue' |
| 3 | import { DECK_MINI_KEY } from './deck' |
| 4 | |
| 5 | const props = withDefaults( |
| 6 | defineProps<{ |
| 7 | mini?: boolean |
| 8 | }>(), |
| 9 | { |
| 10 | mini: false |
| 11 | } |
| 12 | ) |
| 13 | |
| 14 | provide(DECK_MINI_KEY, computed(() => props.mini)) |
| 15 | </script> |
| 16 | |
| 1 | 17 | <template> |
| 2 | | <div class="vp-grid"> |
| 18 | <div class="vp-grid" :class="{ 'vp-grid--mini': mini }"> |
| 3 | 19 | <slot /> |
| 4 | 20 | </div> |
| 5 | 21 | </template> |
| @@ -11,6 +27,10 @@ |
| 11 | 27 | gap: 8px; |
| 12 | 28 | } |
| 13 | 29 | |
| 30 | .vp-grid--mini { |
| 31 | grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); |
| 32 | } |
| 33 | |
| 14 | 34 | @media (min-width: 640px) { |
| 15 | 35 | .vp-grid { |
| 16 | 36 | gap: 8px; |
| @@ -22,4 +42,4 @@ |
| 22 | 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 @@ |
| 1 | import type { InjectionKey, Ref } from 'vue' |
| 2 | |
| 3 | export 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 | 18 | ## Global |
| 19 | 19 | |
| 20 | | <Deck> |
| 20 | <Deck mini> |
| 21 | 21 | <Card title="Multilingual" href="/nonen/multilingual" icon=":twemoji-globe-showing-asia-australia:" /> |
| 22 | 22 | </Deck> |
| 23 | 23 | |
| 24 | 24 | ## Asia |
| 25 | 25 | |
| 26 | | <Deck> |
| 26 | <Deck mini> |
| 27 | 27 | <Card title="Arabic" href="/nonen/arabic" icon=":twemoji-flag-united-arab-emirates:" /> |
| 28 | 28 | <Card title="Chinese" href="/nonen/chinese" icon=":twemoji-flag-china:" /> |
| 29 | 29 | <Card title="Indian" href="/nonen/indian" icon=":twemoji-flag-india:" /> |
| @@ -36,7 +36,7 @@ og: |
| 36 | 36 | |
| 37 | 37 | ## Europe |
| 38 | 38 | |
| 39 | | <Deck> |
| 39 | <Deck mini> |
| 40 | 40 | <Card title="Catalan" href="/nonen/catalan" icon=":twemoji-flag-spain:" /> |
| 41 | 41 | <Card title="French" href="/nonen/french" icon=":twemoji-flag-france:" /> |
| 42 | 42 | <Card title="German" href="/nonen/german" icon=":twemoji-flag-germany:" /> |