|
1 | 1 | <template> |
2 | | - <v-list |
3 | | - :color="drawerOptions.color ? 'white' : 'primary'" |
4 | | - density="compact" |
| 2 | + <v-navigation-drawer |
| 3 | + v-model="drawer" |
| 4 | + :absolute="drawerOptions.absolute" |
| 5 | + class="main-nav-drawer " |
| 6 | + :color="drawerOptions.color" |
| 7 | + :elevation="drawerOptions.elevation" |
5 | 8 | > |
6 | | - <template v-for="item, k in menuItems"> |
7 | | - <v-list-group |
8 | | - v-if="item.items" |
9 | | - :key="k" |
10 | | - :value="item.title" |
11 | | - > |
12 | | - <template v-slot:activator="{ props }"> |
13 | | - <v-list-item |
14 | | - density="compact" |
15 | | - v-bind="props" |
16 | | - :prepend-icon="item.icon" |
17 | | - :title="item.title" |
18 | | - ></v-list-item> |
19 | | - </template> |
20 | | - |
21 | | - <template v-for="subItem in item.items"> |
22 | | - <v-list-item |
23 | | - v-if="subItem.href" |
24 | | - :key="subItem.title" |
25 | | - class="sub-items" |
26 | | - :href="subItem.href" |
27 | | - :prepend-icon="subItem.icon" |
28 | | - > |
29 | | - <div v-html="subItem.title"></div> |
30 | | - </v-list-item> |
31 | | - </template> |
32 | | - </v-list-group> |
33 | | - |
34 | | - <v-list-item |
35 | | - v-else |
36 | | - :key="item.title" |
37 | | - :class="{ |
38 | | - 'v-list-item--active': active === item.href, |
39 | | - }" |
40 | | - :color="drawerOptions.color ? 'white' : 'primary'" |
41 | | - :href="item.href" |
42 | | - link |
43 | | - :title="item.title" |
44 | | - > |
45 | | - |
46 | | - <template v-slot:prepend> |
47 | | - <v-icon :icon="item.icon"></v-icon> |
48 | | - </template> |
49 | | - </v-list-item> |
50 | | - </template> |
51 | | - </v-list> |
| 9 | + <v-list |
| 10 | + :color="drawerOptions.color ? 'white' : 'primary'" |
| 11 | + density="compact" |
| 12 | + > |
| 13 | + <template v-for="item, k in menuItems"> |
| 14 | + <v-list-group |
| 15 | + v-if="item.items" |
| 16 | + :key="k" |
| 17 | + :value="item.title" |
| 18 | + > |
| 19 | + <template v-slot:activator="{ props }"> |
| 20 | + <v-list-item |
| 21 | + v-bind="props" |
| 22 | + :prepend-icon="item.icon" |
| 23 | + :title="item.title" |
| 24 | + ></v-list-item> |
| 25 | + </template> |
| 26 | + |
| 27 | + <template v-for="subItem in item.items"> |
| 28 | + <v-list-item |
| 29 | + v-if="subItem.href" |
| 30 | + :key="subItem.title" |
| 31 | + class="sub-items" |
| 32 | + :href="subItem.href" |
| 33 | + :prepend-icon="subItem.icon" |
| 34 | + > |
| 35 | + <div v-html="subItem.title"></div> |
| 36 | + </v-list-item> |
| 37 | + </template> |
| 38 | + </v-list-group> |
| 39 | + |
| 40 | + <v-list-item |
| 41 | + v-else |
| 42 | + :key="item.title" |
| 43 | + :class="{ |
| 44 | + 'v-list-item--active': active === item.href, |
| 45 | + }" |
| 46 | + :color="drawerOptions.color ? 'white' : 'primary'" |
| 47 | + :href="item.href" |
| 48 | + link |
| 49 | + :title="item.title" |
| 50 | + > |
| 51 | + |
| 52 | + <template v-slot:prepend> |
| 53 | + <v-icon :icon="item.icon"></v-icon> |
| 54 | + </template> |
| 55 | + </v-list-item> |
| 56 | + </template> |
| 57 | + </v-list> |
| 58 | + </v-navigation-drawer> |
52 | 59 | </template> |
53 | 60 |
|
54 | 61 | <script setup lang="ts"> |
55 | 62 | import { useMenuStore } from '@/stores/menu'; |
56 | 63 |
|
57 | 64 |
|
| 65 | +const drawer = defineModel<boolean>(); |
58 | 66 | const drawerOptions = inject<Docs.DrawerOptions>('drawerOptions')!; |
59 | 67 | const store = useMenuStore(); |
60 | 68 | const active = ref<string>(''); |
@@ -89,14 +97,115 @@ function smoothScroll(): void { |
89 | 97 | } |
90 | 98 | </script> |
91 | 99 |
|
92 | | -<style lang="scss" scoped> |
93 | | -.sub-items { |
94 | | - font-size: .9em; |
95 | | - padding-left: calc(var(--indent-padding) - 10px) !important; |
| 100 | +<style lang="scss"> |
| 101 | +.main-nav-drawer { |
| 102 | + // Navigation Drawer Rail // |
| 103 | + &.v-navigation-drawer--rail { |
| 104 | + &:not(.v-navigation-drawer--is-hovering) { |
| 105 | + --list-item-padding-left: 7px; |
| 106 | + --list-item-level-3-padding-left: 7px; |
| 107 | + } |
| 108 | + } |
| 109 | +
|
| 110 | + // Navigation Drawer Regular // |
| 111 | + .v-navigation-drawer__content { |
| 112 | + .v-list { |
| 113 | + &-item { |
| 114 | + margin-bottom: 4px; |
| 115 | + } |
| 116 | +
|
| 117 | + &-group--prepend { |
| 118 | + padding: 0 !important; |
| 119 | + padding-left: 0 !important; |
| 120 | + } |
| 121 | +
|
| 122 | + &-item__prepend { |
| 123 | + display: flex; |
| 124 | + justify-content: center; |
| 125 | + margin-right: 16px; |
| 126 | + text-align: center !important; |
| 127 | + width: 24px !important; |
| 128 | +
|
| 129 | + > .v-icon { |
| 130 | + margin-inline-end: 0 !important; |
| 131 | + } |
| 132 | +
|
| 133 | + // Level 1 - All Icons // |
| 134 | + svg { |
| 135 | + font-size: 1em; |
| 136 | + width: 1em; |
| 137 | + } |
| 138 | + } |
| 139 | +
|
| 140 | + &-item__spacer { |
| 141 | + display: none; |
| 142 | + } |
| 143 | +
|
| 144 | + // Level 2 // |
| 145 | + &-group__items { |
| 146 | + // Level 2 Dropdown // |
| 147 | + svg { |
| 148 | + font-size: 0.8em; |
| 149 | + width: 0.8em; |
| 150 | + } |
| 151 | +
|
| 152 | + > .v-list { |
| 153 | + &-group { |
| 154 | + > .v-list-item { |
| 155 | + padding-left: var(--list-item-padding-left) !important; |
| 156 | + transition: padding 0.25s ease; |
| 157 | + } |
| 158 | + } |
| 159 | +
|
| 160 | + // Level 3 - First child of dropdowns // |
| 161 | + &-item { |
| 162 | + padding-left: var(--list-item-padding-left) !important; |
| 163 | + transition: padding 0.25s ease; |
| 164 | +
|
| 165 | + svg { |
| 166 | + font-size: 0.8em; |
| 167 | + width: 0.8em; |
| 168 | + } |
| 169 | + } |
| 170 | + } |
| 171 | +
|
| 172 | + // Level 3 // |
| 173 | + .v-list-group__items { |
| 174 | + > .v-list-item { |
| 175 | + padding-left: var(--list-item-level-3-padding-left) !important; |
| 176 | + transition: padding 0.25s ease; |
| 177 | +
|
| 178 | + // Level 3 icons // |
| 179 | + svg { |
| 180 | + font-size: 0.7em; |
| 181 | + width: 0.7em; |
| 182 | + } |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | + } |
| 188 | +
|
| 189 | + .menu-arrow { |
| 190 | + transition: transform 0.3s; |
| 191 | + } |
| 192 | +
|
| 193 | + .v-list-group--open { |
| 194 | + > .v-list-group__header { |
| 195 | + .menu-arrow { |
| 196 | + transform: rotate(-180deg); |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | +
|
| 201 | + .sub-items { |
| 202 | + font-size: .9em; |
| 203 | + padding-left: calc(var(--indent-padding) - 10px) !important; |
96 | 204 |
|
97 | | - :deep(.v-icon) { |
98 | | - font-size: 1em !important; |
99 | | - margin-right: 1em !important; |
| 205 | + .v-icon { |
| 206 | + font-size: 1.3em !important; |
| 207 | + margin-right: 1em !important; |
| 208 | + } |
100 | 209 | } |
101 | 210 | } |
102 | 211 | </style> |
0 commit comments