File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ defineProps <{
3+ title: string
4+ toggleable? : boolean
5+ isVisible? : boolean
6+ scrollToId? : string
7+ }>()
8+
9+ const isVisible = defineModel (' isVisible' , {
10+ default: true ,
11+ })
12+
13+ function toggleVisibility() {
14+ isVisible .value = ! isVisible .value
15+ }
16+ </script >
17+
18+ <template >
19+ <section class =" overflow-hidden scroll-mt-20" >
20+ <header class =" group flex items-center justify-between gap-2 mb-3" >
21+ <h2 class =" group text-xs text-fg-subtle uppercase tracking-wider" >
22+ <a
23+ v-if =" scrollToId"
24+ :href =" `#${scrollToId}`"
25+ class =" inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline"
26+ >
27+ {{ title }}
28+ <span
29+ class =" i-carbon-link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200"
30+ aria-hidden =" true"
31+ />
32+ </a >
33+ <template v-else >{{ title }}</template >
34+ </h2 >
35+
36+ <button
37+ v-if =" toggleable"
38+ @click =" toggleVisibility"
39+ class =" text-xs text-fg-subtle hover:text-fg opacity-0 group-hover:opacity-100 transition-opacity duration-200"
40+ >
41+ {{ isVisible ? 'hide' : 'show' }}
42+ </button >
43+ </header >
44+
45+ <div v-if =" isVisible" class =" space-y-0.5 min-w-0" >
46+ <slot />
47+ </div >
48+ </section >
49+ </template >
You can’t perform that action at this time.
0 commit comments