|
1 | 1 | <script setup lang="ts">
|
| 2 | +import { ref } from 'vue' |
2 | 3 | // import IconButton from './Buttons/IconButton.vue'
|
3 | 4 | // import Dropdown from './Elements/Dropdown.vue'
|
| 5 | +
|
| 6 | +// State for each section's collapse status |
| 7 | +const sections = ref({ |
| 8 | + library: true, |
| 9 | + app: true, |
| 10 | + models: true, |
| 11 | + management: true |
| 12 | +}) |
| 13 | +
|
| 14 | +// Toggle function for sections |
| 15 | +const toggleSection = (section: keyof typeof sections.value) => { |
| 16 | + sections.value[section] = !sections.value[section] |
| 17 | +} |
4 | 18 | </script>
|
5 | 19 |
|
6 | 20 | <template>
|
|
30 | 44 | </li>
|
31 | 45 |
|
32 | 46 | <li>
|
33 |
| - <!-- <Dropdown |
34 |
| - label="Library" |
35 |
| - open |
36 |
| - :elements="[ |
37 |
| - { to: '/', label: 'Components' }, |
38 |
| - { to: '/', label: 'Functions' }, |
39 |
| - { to: '/', label: 'Composability' }, |
40 |
| - { to: '/', label: 'Publishing' }, |
41 |
| - ]"/> --> |
42 |
| - </li> |
43 |
| - |
44 |
| - <li> |
45 |
| - <div class="flex items-center justify-between"> |
| 47 | + <!-- Library Section --> |
| 48 | + <div class="flex items-center justify-between cursor-pointer" @click="toggleSection('library')"> |
46 | 49 | <div class="text-xs text-gray-400 font-semibold leading-6">
|
47 | 50 | Library
|
48 | 51 | </div>
|
49 | 52 |
|
50 | 53 | <div
|
51 |
| - class="i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" /> |
| 54 | + :class="[ |
| 55 | + 'i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700', |
| 56 | + { 'transform -rotate-90': !sections.library } |
| 57 | + ]" /> |
52 | 58 | </div>
|
53 | 59 |
|
54 |
| - <ul role="list" class="mt-2 -mx-2 space-y-1"> |
55 |
| - <li> |
56 |
| - <!-- <IconButton to="/functions"> |
57 |
| - Functions |
58 |
| - </IconButton> --> |
59 |
| - </li> |
60 |
| - |
| 60 | + <ul role="list" class="mt-2 -mx-2 space-y-1 section-content" :class="sections.library ? 'expanded' : 'collapsed'"> |
61 | 61 | <li>
|
62 | 62 | <RouterLink to="/components" class="sidebar-links group">
|
63 | 63 | <div
|
|
92 | 92 | </li>
|
93 | 93 |
|
94 | 94 | <li>
|
95 |
| - <div class="flex items-center justify-between"> |
| 95 | + <!-- App Section --> |
| 96 | + <div class="flex items-center justify-between cursor-pointer" @click="toggleSection('app')"> |
96 | 97 | <div class="text-xs text-gray-400 font-semibold leading-6">
|
97 | 98 | App
|
98 | 99 | </div>
|
99 | 100 |
|
100 | 101 | <div
|
101 |
| - class="i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" /> |
| 102 | + :class="[ |
| 103 | + 'i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700', |
| 104 | + { 'transform -rotate-90': !sections.app } |
| 105 | + ]" /> |
102 | 106 | </div>
|
103 | 107 |
|
104 |
| - <ul role="list" class="mt-2 -mx-2 space-y-1"> |
| 108 | + <ul role="list" class="mt-2 -mx-2 space-y-1 section-content" :class="sections.app ? 'expanded' : 'collapsed'"> |
105 | 109 | <li>
|
106 | 110 | <RouterLink to="/deployments" class="sidebar-links group">
|
107 | 111 | <div
|
|
152 | 156 | </li>
|
153 | 157 |
|
154 | 158 | <li>
|
155 |
| - <div class="flex items-center justify-between"> |
| 159 | + <!-- Models Section --> |
| 160 | + <div class="flex items-center justify-between cursor-pointer" @click="toggleSection('models')"> |
156 | 161 | <div class="text-xs text-gray-400 font-semibold leading-6">
|
157 | 162 | Models
|
158 | 163 | </div>
|
159 | 164 |
|
160 | 165 | <div
|
161 |
| - class="i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" /> |
| 166 | + :class="[ |
| 167 | + 'i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700', |
| 168 | + { 'transform -rotate-90': !sections.models } |
| 169 | + ]" /> |
162 | 170 | </div>
|
163 | 171 |
|
164 |
| - <ul role="list" class="mt-2 -mx-2 space-y-1"> |
| 172 | + <ul role="list" class="mt-2 -mx-2 space-y-1 section-content" :class="sections.models ? 'expanded' : 'collapsed'"> |
165 | 173 | <li>
|
166 | 174 | <RouterLink to="/models/users" class="sidebar-links">
|
167 | 175 | <span
|
|
189 | 197 | </li>
|
190 | 198 |
|
191 | 199 | <li>
|
192 |
| - <div class="flex items-center justify-between"> |
| 200 | + <!-- Management Section --> |
| 201 | + <div class="flex items-center justify-between cursor-pointer" @click="toggleSection('management')"> |
193 | 202 | <div class="text-xs text-gray-400 font-semibold leading-6">
|
194 | 203 | Management
|
195 | 204 | </div>
|
196 | 205 |
|
197 | 206 | <div
|
198 |
| - class="i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" /> |
| 207 | + :class="[ |
| 208 | + 'i-hugeicons-arrow-down-01 h-4 w-4 text-gray-300 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700', |
| 209 | + { 'transform -rotate-90': !sections.management } |
| 210 | + ]" /> |
199 | 211 | </div>
|
200 | 212 |
|
201 |
| - <ul role="list" class="mt-2 -mx-2 space-y-1"> |
| 213 | + <ul role="list" class="mt-2 -mx-2 space-y-1 section-content" :class="sections.management ? 'expanded' : 'collapsed'"> |
202 | 214 | <li>
|
203 | 215 | <RouterLink to="/dns" class="sidebar-links">
|
204 |
| - <!-- <span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 dark:border-gray-600 group-hover:border-blue-600 group-hover:text-blue-600">U</span> --> |
205 | 216 | <div
|
206 | 217 | class="i-hugeicons-global-search h-5 w-5 text-gray-500 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" />
|
207 | 218 | <span class="truncate">DNS</span>
|
|
210 | 221 |
|
211 | 222 | <li>
|
212 | 223 | <RouterLink to="/emails" class="sidebar-links">
|
213 |
| - <!-- <span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 dark:border-gray-600 group-hover:border-blue-600 group-hover:text-blue-600">U</span> --> |
214 | 224 | <div
|
215 | 225 | class="i-hugeicons-at h-5 w-5 text-gray-500 transition duration-150 ease-in-out dark:text-gray-200 group-hover:text-gray-700" />
|
216 | 226 | <span class="truncate">Emails</span>
|
|
285 | 295 | @apply text-blue-gray-600 dark:text-blue-gray-200 hover:text-blue-gray-800 duration-150 ease-in-out transition dark-hover:bg-gray-700 hover:bg-blue-gray-50 flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold;
|
286 | 296 | }
|
287 | 297 |
|
288 |
| -/* Add styles for active state */ |
289 | 298 | .router-link-active {
|
290 | 299 | @apply bg-blue-gray-50 text-blue-600 dark:bg-gray-700 dark:text-blue-400;
|
291 | 300 | }
|
292 | 301 |
|
293 |
| -/* Style for the icons when link is active */ |
294 | 302 | .router-link-active div[class^="i-hugeicons"] {
|
295 | 303 | @apply text-blue-600 dark:text-blue-400;
|
296 | 304 | }
|
297 | 305 |
|
298 |
| -/* Style for the model section letters when active */ |
299 | 306 | .router-link-active span.h-6 {
|
300 | 307 | @apply border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400;
|
301 | 308 | }
|
|
317 | 324 | .active-bottom-link div {
|
318 | 325 | @apply text-blue-600 dark:text-blue-400 !important;
|
319 | 326 | }
|
| 327 | +
|
| 328 | +.section-content { |
| 329 | + @apply overflow-hidden transition-all duration-300 ease-in-out; |
| 330 | +} |
| 331 | +
|
| 332 | +.collapsed { |
| 333 | + @apply max-h-0; |
| 334 | +} |
| 335 | +
|
| 336 | +.expanded { |
| 337 | + @apply max-h-96; |
| 338 | +} |
320 | 339 | </style>
|
0 commit comments