Commit 70a1cc32a2
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/HomeFeatures.vue +13 −3
| @@ -62,6 +62,16 @@ const grid = computed(() => { | |||
| 62 | return undefined | 62 | return undefined |
| 63 | }) | 63 | }) |
| 64 | 64 | ||
| 65 | const panelGrid = computed(() => { | ||
| 66 | if (columnMode.value === 'max') return 'grid-max' | ||
| 67 | const n = props.cards.length | ||
| 68 | if (n === 2) return 'grid-2' | ||
| 69 | if (n === 3) return 'grid-3' | ||
| 70 | if (n % 3 === 0) return 'grid-6' | ||
| 71 | if (n > 3) return 'grid-4' | ||
| 72 | return undefined | ||
| 73 | }) | ||
| 74 | |||
| 65 | const KNOWN_PREFIXES = /^(lucide|mdi|ic|mingcute|material-symbols|simple-icons|uil|octicon|logos|akar-icons|map|bi|streamline-logos|streamline-ultimate|streamline-sharp|iconoir)-/ | 75 | const KNOWN_PREFIXES = /^(lucide|mdi|ic|mingcute|material-symbols|simple-icons|uil|octicon|logos|akar-icons|map|bi|streamline-logos|streamline-ultimate|streamline-sharp|iconoir)-/ |
| 66 | 76 | ||
| 67 | function cardIcon(card: HomeCard) { | 77 | function cardIcon(card: HomeCard) { |
| @@ -249,9 +259,9 @@ function onHandlePointerUp() { | |||
| 249 | <div class="card-sections"> | 259 | <div class="card-sections"> |
| 250 | <!-- Homepage section (draggable) --> | 260 | <!-- Homepage section (draggable) --> |
| 251 | <div class="section-label">Homepage</div> | 261 | <div class="section-label">Homepage</div> |
| 252 | <ul ref="cardListEl" class="card-list" :class="grid"> | 262 | <ul ref="cardListEl" class="card-list" :class="panelGrid"> |
| 253 | <li v-if="homepageSectionCards.length === 0" class="empty-box"> | 263 | <li v-if="homepageSectionCards.length === 0" class="empty-box"> |
| 254 | <span class="empty-hint">No cards selected — add some from below</span> | 264 | <span class="empty-hint">No cards have been selected</span> |
| 255 | </li> | 265 | </li> |
| 256 | <li | 266 | <li |
| 257 | v-for="card in homepageSectionCards" | 267 | v-for="card in homepageSectionCards" |
| @@ -289,7 +299,7 @@ function onHandlePointerUp() { | |||
| 289 | <!-- Other sections (Pages, Extensions, Other…) --> | 299 | <!-- Other sections (Pages, Extensions, Other…) --> |
| 290 | <template v-for="section in otherSections" :key="section.label"> | 300 | <template v-for="section in otherSections" :key="section.label"> |
| 291 | <div class="section-label">{{ section.label }}</div> | 301 | <div class="section-label">{{ section.label }}</div> |
| 292 | <ul class="card-list" :class="grid"> | 302 | <ul class="card-list" :class="panelGrid"> |
| 293 | <li v-if="section.cards.length === 0" class="empty-box"> | 303 | <li v-if="section.cards.length === 0" class="empty-box"> |
| 294 | <span class="empty-hint">All cards from this section have been selected</span> | 304 | <span class="empty-hint">All cards from this section have been selected</span> |
| 295 | </li> | 305 | </li> |