Commit b99618ee41
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/Collapsible.vue +25 −1
| @@ -10,7 +10,31 @@ const open = ref(false) | |||
| 10 | 10 | ||
| 11 | <template> | 11 | <template> |
| 12 | <details class="details custom-block" :open="open || undefined" @toggle="open = ($event.target as HTMLDetailsElement).open"> | 12 | <details class="details custom-block" :open="open || undefined" @toggle="open = ($event.target as HTMLDetailsElement).open"> |
| 13 | <summary>{{ title || 'Details' }}</summary> | 13 | <summary> |
| 14 | <span v-if="open" class="i-lucide-arrow-down collapsible-icon" /> | ||
| 15 | <span v-else class="i-lucide-arrow-right collapsible-icon" /> | ||
| 16 | {{ title || 'Details' }} | ||
| 17 | </summary> | ||
| 14 | <slot /> | 18 | <slot /> |
| 15 | </details> | 19 | </details> |
| 16 | </template> | 20 | </template> |
| 21 | |||
| 22 | <style scoped> | ||
| 23 | summary { | ||
| 24 | list-style: none; | ||
| 25 | display: flex; | ||
| 26 | align-items: center; | ||
| 27 | gap: 0.4em; | ||
| 28 | cursor: pointer; | ||
| 29 | } | ||
| 30 | |||
| 31 | summary::-webkit-details-marker { | ||
| 32 | display: none; | ||
| 33 | } | ||
| 34 | |||
| 35 | .collapsible-icon { | ||
| 36 | width: 1em; | ||
| 37 | height: 1em; | ||
| 38 | flex-shrink: 0; | ||
| 39 | } | ||
| 40 | </style>\ No newline at end of file | ||