@@ -70,22 +70,11 @@ const sortedOptionalDependencies = computed(() => {
7070<template >
7171 <div class =" space-y-8" >
7272 <!-- Dependencies -->
73- <section id =" dependencies" v-if =" sortedDependencies.length > 0" class =" scroll-mt-20" >
74- <h2
75- id =" dependencies-heading"
76- class =" group text-xs text-fg-subtle uppercase tracking-wider mb-3"
77- >
78- <a
79- href =" #dependencies"
80- class =" inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline"
81- >
82- {{ $t('package.dependencies.title', { count: sortedDependencies.length }) }}
83- <span
84- class =" i-carbon:link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200"
85- aria-hidden =" true"
86- />
87- </a >
88- </h2 >
73+ <CollapsibleSection
74+ v-if =" sortedDependencies.length > 0"
75+ id =" dependencies"
76+ :title =" $t('package.dependencies.title', { count: sortedDependencies.length })"
77+ >
8978 <ul class =" space-y-1 list-none m-0 p-0" :aria-label =" $t('package.dependencies.list_label')" >
9079 <li
9180 v-for =" [dep, version] in sortedDependencies.slice(0, depsExpanded ? undefined : 10)"
@@ -151,33 +140,14 @@ const sortedOptionalDependencies = computed(() => {
151140 </span >
152141 </li >
153142 </ul >
154- <button
155- v-if =" sortedDependencies.length > 10 && !depsExpanded"
156- type =" button"
157- class =" mt-2 font-mono text-xs text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
158- @click =" depsExpanded = true"
159- >
160- {{ $t('package.dependencies.show_all', { count: sortedDependencies.length }) }}
161- </button >
162- </section >
143+ </CollapsibleSection >
163144
164145 <!-- Peer Dependencies -->
165- <section id =" peer-dependencies" v-if =" sortedPeerDependencies.length > 0" class =" scroll-mt-20" >
166- <h2
167- id =" peer-dependencies-heading"
168- class =" group text-xs text-fg-subtle uppercase tracking-wider mb-3"
169- >
170- <a
171- href =" #peer-dependencies"
172- class =" inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline"
173- >
174- {{ $t('package.peer_dependencies.title', { count: sortedPeerDependencies.length }) }}
175- <span
176- class =" i-carbon:link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200"
177- aria-hidden =" true"
178- />
179- </a >
180- </h2 >
146+ <CollapsibleSection
147+ v-if =" sortedPeerDependencies.length > 0"
148+ id =" peer-dependencies"
149+ :title =" $t('package.peer_dependencies.title', { count: sortedPeerDependencies.length })"
150+ >
181151 <ul
182152 class =" space-y-1 list-none m-0 p-0"
183153 :aria-label =" $t('package.peer_dependencies.list_label')"
@@ -223,31 +193,16 @@ const sortedOptionalDependencies = computed(() => {
223193 >
224194 {{ $t('package.peer_dependencies.show_all', { count: sortedPeerDependencies.length }) }}
225195 </button >
226- </section >
196+ </CollapsibleSection >
227197
228198 <!-- Optional Dependencies -->
229- <section
230- id =" optional-dependencies"
199+ <CollapsibleSection
231200 v-if =" sortedOptionalDependencies.length > 0"
232- class =" scroll-mt-20"
201+ id =" optional-dependencies"
202+ :title ="
203+ $t('package.optional_dependencies.title', { count: sortedOptionalDependencies.length })
204+ "
233205 >
234- <h2
235- id =" optional-dependencies-heading"
236- class =" group text-xs text-fg-subtle uppercase tracking-wider mb-3"
237- >
238- <a
239- href =" #optional-dependencies"
240- class =" inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline"
241- >
242- {{
243- $t('package.optional_dependencies.title', { count: sortedOptionalDependencies.length })
244- }}
245- <span
246- class =" i-carbon:link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200"
247- aria-hidden =" true"
248- />
249- </a >
250- </h2 >
251206 <ul
252207 class =" space-y-1 list-none m-0 p-0"
253208 :aria-label =" $t('package.optional_dependencies.list_label')"
@@ -286,6 +241,6 @@ const sortedOptionalDependencies = computed(() => {
286241 $t('package.optional_dependencies.show_all', { count: sortedOptionalDependencies.length })
287242 }}
288243 </button >
289- </section >
244+ </CollapsibleSection >
290245 </div >
291246</template >
0 commit comments