Commit 0d24256c4d
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/BookmarksPanel.vue +32 −6
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { onClickOutside } from '@vueuse/core' |
| 3 | import { Bookmark, BookMarked, Hash, X } from 'lucide-vue-next' | |
| 3 | import { Bookmark, Hash, X } from 'lucide-vue-next' | |
| 4 | 4 | import { computed, ref } from 'vue' |
| 5 | 5 | import type { DefaultTheme } from 'vitepress/theme' |
| 6 | 6 | import type { HomeCard } from '../../configs/constants' |
| @@ -147,8 +147,9 @@ const grouped = computed((): GroupEntry[] => { | ||
| 147 | 147 | @scroll.passive="onScroll" |
| 148 | 148 | > |
| 149 | 149 | <div v-if="bookmarks.length === 0" class="bookmarks-empty"> |
| 150 | <BookMarked :size="128" :stroke-width="1" class="bookmarks-empty-icon" /> | |
| 151 | <p class="bookmarks-empty-hint">Click the bookmark icon next to any heading in the table of contents to save it here.</p> | |
| 150 | <span class="bookmarks-empty-kaomoji">(˶ᵔ ᵕ ᵔ˶)</span> | |
| 151 | <p class="bookmarks-empty-hint bookmarks-empty-hint--desktop">Tip: Hover over any primary heading under <strong>On this page</strong> and click <Bookmark :size="13" :stroke-width="2" class="bookmarks-empty-inline-icon" /> to bookmark it.</p> | |
| 152 | <p class="bookmarks-empty-hint bookmarks-empty-hint--mobile">Tip: Tap <strong>On this page</strong> and press <Bookmark :size="13" :stroke-width="2" class="bookmarks-empty-inline-icon" /> next to any primary heading to bookmark it.</p> | |
| 152 | 153 | </div> |
| 153 | 154 | <div v-else class="bookmarks-groups"> |
| 154 | 155 | <template v-for="group in grouped" :key="group.type === 'page' ? group.path : group.section"> |
| @@ -288,9 +289,11 @@ const grouped = computed((): GroupEntry[] => { | ||
| 288 | 289 | overflow: hidden; |
| 289 | 290 | } |
| 290 | 291 | |
| 291 | .bookmarks-empty-icon { | |
| 292 | .bookmarks-empty-kaomoji { | |
| 293 | font-size: 28px; | |
| 292 | 294 | color: var(--vp-c-text-3); |
| 293 | flex: none; | |
| 295 | line-height: 1; | |
| 296 | user-select: none; | |
| 294 | 297 | } |
| 295 | 298 | |
| 296 | 299 | .bookmarks-empty-hint { |
| @@ -303,6 +306,17 @@ const grouped = computed((): GroupEntry[] => { | ||
| 303 | 306 | word-break: break-word; |
| 304 | 307 | } |
| 305 | 308 | |
| 309 | .bookmarks-empty-hint--mobile { | |
| 310 | display: none; | |
| 311 | } | |
| 312 | ||
| 313 | .bookmarks-empty-inline-icon { | |
| 314 | display: inline; | |
| 315 | vertical-align: middle; | |
| 316 | position: relative; | |
| 317 | top: -1px; | |
| 318 | } | |
| 319 | ||
| 306 | 320 | .bookmarks-groups { |
| 307 | 321 | display: flex; |
| 308 | 322 | flex-direction: column; |
| @@ -437,6 +451,16 @@ const grouped = computed((): GroupEntry[] => { | ||
| 437 | 451 | display: none; |
| 438 | 452 | } |
| 439 | 453 | |
| 454 | @media (max-width: 1279px) { | |
| 455 | .bookmarks-empty-hint--desktop { | |
| 456 | display: none; | |
| 457 | } | |
| 458 | ||
| 459 | .bookmarks-empty-hint--mobile { | |
| 460 | display: block; | |
| 461 | } | |
| 462 | } | |
| 463 | ||
| 440 | 464 | @media (max-width: 767px) { |
| 441 | 465 | .bookmarks-panel { |
| 442 | 466 | position: fixed; |
| @@ -458,11 +482,13 @@ const grouped = computed((): GroupEntry[] => { | ||
| 458 | 482 | flex: 1; |
| 459 | 483 | height: auto; |
| 460 | 484 | min-height: 0; |
| 485 | display: flex; | |
| 486 | flex-direction: column; | |
| 461 | 487 | } |
| 462 | 488 | |
| 463 | 489 | .bookmarks-empty { |
| 464 | min-height: 0; | |
| 465 | 490 | flex: 1; |
| 491 | min-height: 0; | |
| 466 | 492 | } |
| 467 | 493 | |
| 468 | 494 | .bookmarks-mobile-header { |