|
5 | 5 | <v-list
|
6 | 6 | ref="rootEl"
|
7 | 7 | bg-color="transparent"
|
8 |
| - class="py-0" |
| 8 | + class="pa-0" |
9 | 9 | density="compact"
|
10 | 10 | nav
|
11 | 11 | >
|
12 | 12 | <template v-for="(group, i) in props.groups">
|
13 |
| - <v-divider |
14 |
| - v-if="i !== 0" |
15 |
| - class="mb-2 mt-2 ms-2 me-n2" |
16 |
| - /> |
17 |
| - |
18 |
| - <div class="text-high-emphasis font-weight-black text-uppercase"> |
19 |
| - {{ group.name }} |
20 |
| - </div> |
21 |
| - |
22 |
| - <template v-for="(child, ci) in group.items"> |
23 |
| - <v-list-item |
24 |
| - v-if="child.items[0]._highlightResult.hierarchy.lvl1.matchLevel === 'full'" |
25 |
| - :key="`search-${i}-${ci}`" |
26 |
| - :to="getPathname(child)" |
27 |
| - > |
28 |
| - <v-list-item-title> |
29 |
| - <div class="d-inline-block" v-html="child.items[0]._highlightResult.hierarchy.lvl1.value" /> |
30 |
| - |
31 |
| - <v-list-item-subtitle class="d-inline-flex ps-1"> |
32 |
| - › Home |
33 |
| - </v-list-item-subtitle> |
34 |
| - </v-list-item-title> |
35 |
| - </v-list-item> |
36 |
| - |
37 |
| - <template v-else> |
| 13 | + <app-sheet border :class="['pa-3', i !== 0 && 'mt-4']"> |
| 14 | + <div class="text-high-emphasis font-weight-bold d-flex align-center text-h6"> |
| 15 | + <v-icon |
| 16 | + :icon="getIcon(group)" |
| 17 | + color="medium-emphasis" |
| 18 | + class="me-2" |
| 19 | + size="22" |
| 20 | + /> |
| 21 | + |
| 22 | + {{ group.name }} |
| 23 | + </div> |
| 24 | + |
| 25 | + <template v-for="(child, ci) in group.items"> |
38 | 26 | <v-list-item
|
39 |
| - :key="`search-${i}-${child.name}`" |
| 27 | + v-if="child.items[0]._highlightResult.hierarchy.lvl1.matchLevel === 'full'" |
| 28 | + :key="`search-${i}-${ci}`" |
| 29 | + :to="getPathname(child)" |
40 | 30 | class="mb-0"
|
| 31 | + append-icon="mdi-chevron-right" |
| 32 | + prepend-icon="mdi-home-outline" |
41 | 33 | >
|
42 |
| - <v-list-item-title v-html="child.name" /> |
43 |
| - </v-list-item> |
| 34 | + <template #prepend> |
| 35 | + <v-icon class="me-n6" size="18" /> |
| 36 | + </template> |
44 | 37 |
|
45 |
| - <v-list-item |
46 |
| - v-for="(item, it) in child.items" |
47 |
| - :key="`search-${i}-${ci}-${it}-children`" |
48 |
| - :to="item.url" |
49 |
| - class="ps-4 mb-0" |
50 |
| - > |
51 |
| - <v-list-item-subtitle |
52 |
| - class="text-wrap font-weight-medium" |
53 |
| - v-html="makeBreadcrumbs(item)" |
54 |
| - /> |
55 |
| - |
56 |
| - <v-list-item-subtitle |
57 |
| - v-if="item.content" |
58 |
| - class="text-caption text-wrap text-high-emphasis font-weight-regular ps-2" |
59 |
| - v-html="truncateContent(item)" |
60 |
| - /> |
| 38 | + <template #append> |
| 39 | + <v-icon size="16" /> |
| 40 | + </template> |
| 41 | + |
| 42 | + <v-list-item-title> |
| 43 | + <div class="d-inline-block" v-html="child.items[0]._highlightResult.hierarchy.lvl1.value" /> |
| 44 | + |
| 45 | + <v-list-item-subtitle class="d-inline-flex ps-1"> |
| 46 | + › Home |
| 47 | + </v-list-item-subtitle> |
| 48 | + </v-list-item-title> |
61 | 49 | </v-list-item>
|
| 50 | + |
| 51 | + <template v-else> |
| 52 | + <v-list-item |
| 53 | + v-for="(item, it) in child.items" |
| 54 | + :key="`search-${i}-${ci}-${it}-children`" |
| 55 | + :to="item.url" |
| 56 | + :prepend-icon="item.url.indexOf('#') > -1 ? 'mdi-pound' : undefined" |
| 57 | + :append-icon="item.url.indexOf('#') > -1 ? 'mdi-chevron-right' : undefined" |
| 58 | + class="ps-4 mb-0" |
| 59 | + > |
| 60 | + <template #prepend> |
| 61 | + <v-icon size="14" class="me-n6 ms-1" /> |
| 62 | + </template> |
| 63 | + |
| 64 | + <template #append> |
| 65 | + <v-icon size="16" /> |
| 66 | + </template> |
| 67 | + |
| 68 | + <v-list-item-subtitle |
| 69 | + class="text-wrap font-weight-bold" |
| 70 | + v-html="makeBreadcrumbs(item)" |
| 71 | + /> |
| 72 | + |
| 73 | + <v-list-item-subtitle |
| 74 | + v-if="item.content" |
| 75 | + class="text-caption text-wrap text-high-emphasis font-weight-regular" |
| 76 | + v-html="truncateContent(item)" |
| 77 | + /> |
| 78 | + </v-list-item> |
| 79 | + </template> |
62 | 80 | </template>
|
63 |
| - </template> |
| 81 | + </app-sheet> |
64 | 82 | </template>
|
65 | 83 | </v-list>
|
66 | 84 | </template>
|
|
69 | 87 | import { ref } from 'vue'
|
70 | 88 | import type { VList } from 'vuetify/components'
|
71 | 89 |
|
| 90 | + // Stores |
| 91 | + import { useAppStore } from '@/store/app' |
| 92 | +
|
72 | 93 | const props = defineProps<{ groups: any[] }>()
|
73 | 94 |
|
| 95 | + const app = useAppStore() |
| 96 | +
|
74 | 97 | const rootEl = ref<VList>()
|
75 | 98 | defineExpose({ rootEl })
|
76 | 99 |
|
|
103 | 126 | function getPathname (group: any) {
|
104 | 127 | return new URL(location.origin + group.items[0].url).pathname
|
105 | 128 | }
|
| 129 | + function getIcon (group: Record<string, any>) { |
| 130 | + let name = group.name.toLowerCase().replace(/[^a-z]/g, '-') |
| 131 | +
|
| 132 | + if (name === 'styles-and-animations') name = 'styles' |
| 133 | +
|
| 134 | + return app.categories?.[name]?.icon ?? '$vuetify' |
| 135 | + } |
106 | 136 | </script>
|
107 | 137 |
|
108 | 138 | <style lang="sass" scoped>
|
|
0 commit comments