Commit 25157891dd

25157891dd1235f3de3d8962a5af035161749d34

parent: a5cac01984

Unregistered key

taskylizard <75871323+taskylizard@users.noreply.github.com> · 2025-05-24 16:37 UTC

feat: sidebar legend modal

Layout: unified · split

docs/.vitepress/theme/components/LegendModal.vue added +139
@@ -0,0 +1,139 @@
1<!--
2 Copyright (c) 2025 taskylizard
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15-->
16<script setup lang="ts">
17defineProps<{
18 isOpen: boolean
19}>()
20
21defineEmits<{
22 (e: 'close'): void
23}>()
24
25const sections = [
26 {
27 title: 'Frequent',
28 items: [
29 { icon: 'i-twemoji-glowing-star', label: 'Favorite' },
30 { icon: 'i-material-symbols-directions-alt', label: 'Proxies' },
31 { icon: 'i-material-symbols-person-add', label: 'Needs account' },
32 { icon: 'i-material-symbols-help', label: 'Help / Docs' },
33 { icon: 'i-mdi-arrow-right-bold', label: 'Related' }
34 ]
35 },
36 {
37 title: 'Type',
38 items: [
39 {
40 icon: 'i-material-symbols-cloud-download-outline-rounded',
41 label: 'Online / DDL'
42 },
43 { icon: 'i-lucide-magnet', label: 'Torrent / p2p' },
44 { icon: 'i-iconoir-floppy-disk', label: 'Local' }
45 ]
46 },
47 {
48 title: 'Price',
49 items: [
50 { icon: 'i-ic-round-attach-money', label: 'Paid' },
51 { icon: 'i-ic-round-currency-exchange', label: 'Subscription' },
52 { icon: 'i-akar-icons-coin', label: 'Coin / Point' },
53 { icon: 'i-ic-round-add-shopping-cart', label: 'Freemium' }
54 ]
55 },
56 {
57 title: 'Source',
58 items: [{ icon: 'i-material-symbols-lock-outline', label: 'Closed Source' }]
59 },
60 {
61 title: 'Others',
62 items: [
63 { icon: 'i-material-symbols-science', label: 'Nightly build' },
64 { icon: 'i-lucide-mail', label: 'Feedback' },
65 { icon: 'i-material-symbols-info-outline-rounded', label: 'More Info' }
66 ]
67 }
68]
69</script>
70
71<template>
72 <Teleport to="body">
73 <Transition name="modal">
74 <div
75 v-if="isOpen"
76 class="fixed inset-0 z-9999 p-4 sm:p-6 overflow-y-auto"
77 >
78 <!-- Backdrop -->
79 <div
80 class="fixed inset-0 bg-black/50 backdrop-blur-sm"
81 @click="$emit('close')"
82 />
83
84 <!-- Modal -->
85 <div
86 class="relative mx-auto bg-$vp-c-bg rounded-lg border-2 border-$vp-c-default-soft p-4 sm:p-6 shadow-xl w-full max-w-4xl mt-16 mb-8"
87 >
88 <div class="flex justify-between items-center mb-4 sm:mb-6">
89 <h2 class="text-$vp-c-text-1 text-lg sm:text-xl font-bold">
90 Legend
91 </h2>
92 <button
93 class="text-$vp-c-text-2 hover:text-$vp-c-text-1 transition-colors p-1"
94 @click="$emit('close')"
95 >
96 <div class="i-material-symbols-close text-lg" />
97 </button>
98 </div>
99
100 <div class="space-y-8">
101 <div v-for="section in sections" :key="section.title">
102 <h3 class="text-$vp-c-text-1 font-bold mb-3">
103 {{ section.title }}
104 </h3>
105 <div
106 class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-2"
107 >
108 <div
109 v-for="item in section.items"
110 :key="item.label"
111 class="flex flex-col items-center justify-center p-3 rounded-lg bg-$vp-c-bg-alt hover:bg-$vp-c-bg-elv transition-colors"
112 >
113 <div
114 :class="[item.icon, 'text-2xl mb-1 text-$vp-c-text-1']"
115 />
116 <div class="text-$vp-c-text-2 text-xs text-center">
117 {{ item.label }}
118 </div>
119 </div>
120 </div>
121 </div>
122 </div>
123 </div>
124 </div>
125 </Transition>
126 </Teleport>
127</template>
128
129<style scoped>
130.modal-enter-active,
131.modal-leave-active {
132 transition: opacity 0.3s ease;
133}
134
135.modal-enter-from,
136.modal-leave-to {
137 opacity: 0;
138}
139</style>
docs/.vitepress/theme/components/SidebarCard.vue +22 −20
@@ -14,31 +14,33 @@
14 limitations under the License. 14 limitations under the License.
15--> 15-->
16<script setup lang="ts"> 16<script setup lang="ts">
17import Field from './CardField.vue' 17import { ref } from 'vue'
18
19import LegendModal from './LegendModal.vue'
20
21const isModalOpen = ref(false)
22
23const focusLegendModal = () => {
24 isModalOpen.value = true
25}
18</script> 26</script>
19 27
20<template> 28<template>
21 <div 29 <div
22 class="bg-$vp-c-bg hover:bg-$vp-c-bg/40 border-$vp-c-default-soft hover:border-primary transition-border relative z-0 rounded-lg border-2 border-solid p-5 duration-500 mt-2" 30 class="bg-$vp-c-bg hover:bg-$vp-c-bg/40 border-$vp-c-default-soft hover:border-primary transition-border relative z-0 rounded-lg border-2 border-solid p-5 duration-500 mt-2"
23 > 31 >
24 <div class="align-center mb-4 flex justify-between"> 32 <button class="w-full text-left" @click="isModalOpen = true">
25 <div class="text-$vp-c-text-1 lh-relaxed text-sm font-bold">Legend</div> 33 <div class="align-center flex items-center gap-2">
26 </div> 34 <div
27 <Field icon="i-twemoji-glowing-star">Favorite</Field> 35 class="i-material-symbols-info-outline-rounded text-$vp-c-text-2"
28 <Field icon="i-material-symbols-lock-outline">Closed Source</Field> 36 />
29 <Field icon="i-ic-round-attach-money">Paid</Field> 37 <div class="text-$vp-c-text-1 lh-relaxed text-sm font-bold">Legend</div>
30 <Field icon="i-ic-round-currency-exchange">Subscription</Field> 38 </div>
31 <Field icon="i-akar-icons-coin">Coin / Point</Field> 39 <div class="text-$vp-c-text-2 text-xs mt-1">
32 <Field icon="i-ic-round-add-shopping-cart">Freemium</Field> 40 Click to view all icons and their meanings
33 <Field icon="i-material-symbols-cloud-download-outline-rounded">Online / DDL</Field> 41 </div>
34 <Field icon="i-lucide-magnet">Torrent / p2p</Field> 42 </button>
35 <Field icon="i-iconoir-floppy-disk">Local</Field> 43
36 <Field icon="i-material-symbols-science">Nightly build</Field> 44 <LegendModal :is-open="isModalOpen" @close="isModalOpen = false" />
37 <Field icon="i-lucide-mail">Feedback</Field>
38 <Field icon="i-material-symbols-directions-alt">Proxies</Field>
39 <Field icon="i-material-symbols-help">Help / Docs</Field>
40 <Field icon="i-material-symbols-person-add">Needs account</Field>
41 <Field icon="i-material-symbols-info-outline-rounded">More Info</Field>
42 <Field icon="i-mdi-arrow-right-bold">Related</Field>
43 </div> 45 </div>
44</template> 46</template>