Commit 0d24256c4d
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/BookmarksPanel.vue +32 −6
| @@ -1,6 +1,6 @@ | |||
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import { onClickOutside } from '@vueuse/core' | 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 | import { computed, ref } from 'vue' | 4 | import { computed, ref } from 'vue' |
| 5 | import type { DefaultTheme } from 'vitepress/theme' | 5 | import type { DefaultTheme } from 'vitepress/theme' |
| 6 | import type { HomeCard } from '../../configs/constants' | 6 | import type { HomeCard } from '../../configs/constants' |
| @@ -147,8 +147,9 @@ const grouped = computed((): GroupEntry[] => { | |||
| 147 | @scroll.passive="onScroll" | 147 | @scroll.passive="onScroll" |
| 148 | > | 148 | > |
| 149 | <div v-if="bookmarks.length === 0" class="bookmarks-empty"> | 149 | <div v-if="bookmarks.length === 0" class="bookmarks-empty"> |
| 150 | <BookMarked :size="128" :stroke-width="1" class="bookmarks-empty-icon" /> | 150 | <span class="bookmarks-empty-kaomoji">(˶ᵔ ᵕ ᵔ˶)</span> |
| 151 | <p class="bookmarks-empty-hint">Click the bookmark icon next to any heading in the table of contents to save it here.</p> | 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 | </div> | 153 | </div> |
| 153 | <div v-else class="bookmarks-groups"> | 154 | <div v-else class="bookmarks-groups"> |
| 154 | <template v-for="group in grouped" :key="group.type === 'page' ? group.path : group.section"> | 155 | <template v-for="group in grouped" :key="group.type === 'page' ? group.path : group.section"> |
| @@ -288,9 +289,11 @@ const grouped = computed((): GroupEntry[] => { | |||
| 288 | overflow: hidden; | 289 | overflow: hidden; |
| 289 | } | 290 | } |
| 290 | 291 | ||
| 291 | .bookmarks-empty-icon { | 292 | .bookmarks-empty-kaomoji { |
| 293 | font-size: 28px; | ||
| 292 | color: var(--vp-c-text-3); | 294 | color: var(--vp-c-text-3); |
| 293 | flex: none; | 295 | line-height: 1; |
| 296 | user-select: none; | ||
| 294 | } | 297 | } |
| 295 | 298 | ||
| 296 | .bookmarks-empty-hint { | 299 | .bookmarks-empty-hint { |
| @@ -303,6 +306,17 @@ const grouped = computed((): GroupEntry[] => { | |||
| 303 | word-break: break-word; | 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 | .bookmarks-groups { | 320 | .bookmarks-groups { |
| 307 | display: flex; | 321 | display: flex; |
| 308 | flex-direction: column; | 322 | flex-direction: column; |
| @@ -437,6 +451,16 @@ const grouped = computed((): GroupEntry[] => { | |||
| 437 | display: none; | 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 | @media (max-width: 767px) { | 464 | @media (max-width: 767px) { |
| 441 | .bookmarks-panel { | 465 | .bookmarks-panel { |
| 442 | position: fixed; | 466 | position: fixed; |
| @@ -458,11 +482,13 @@ const grouped = computed((): GroupEntry[] => { | |||
| 458 | flex: 1; | 482 | flex: 1; |
| 459 | height: auto; | 483 | height: auto; |
| 460 | min-height: 0; | 484 | min-height: 0; |
| 485 | display: flex; | ||
| 486 | flex-direction: column; | ||
| 461 | } | 487 | } |
| 462 | 488 | ||
| 463 | .bookmarks-empty { | 489 | .bookmarks-empty { |
| 464 | min-height: 0; | ||
| 465 | flex: 1; | 490 | flex: 1; |
| 491 | min-height: 0; | ||
| 466 | } | 492 | } |
| 467 | 493 | ||
| 468 | .bookmarks-mobile-header { | 494 | .bookmarks-mobile-header { |