Skip to content

Commit 7c1cea8

Browse files
feat(ui): move fund to the package header (#2170)
1 parent eea12a9 commit 7c1cea8

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

app/components/Package/ExternalLinks.vue

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@ const homepageUrl = computed(() => {
2323
return homepage
2424
})
2525
26-
const fundingUrl = computed(() => {
27-
let funding = displayVersion.value?.funding
28-
if (Array.isArray(funding)) funding = funding[0]
29-
30-
if (!funding) return null
31-
32-
return typeof funding === 'string' ? funding : funding.url
33-
})
34-
3526
const PROVIDER_ICONS: Record<string, IconClass> = {
3627
github: 'i-simple-icons:github',
3728
gitlab: 'i-simple-icons:gitlab',
@@ -97,10 +88,5 @@ const repoProviderIcon = computed((): IconClass => {
9788
{{ $t('package.links.jsr') }}
9889
</LinkBase>
9990
</li>
100-
<li v-if="fundingUrl">
101-
<LinkBase :to="fundingUrl" classicon="i-lucide:heart">
102-
{{ $t('package.links.fund') }}
103-
</LinkBase>
104-
</li>
10591
</ul>
10692
</template>

app/components/Package/Header.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ const likeAction = async () => {
241241
isLikeActionPending.value = false
242242
}
243243
}
244+
245+
const fundingUrl = computed(() => {
246+
let funding = props.displayVersion?.funding
247+
if (Array.isArray(funding)) funding = funding[0]
248+
249+
if (!funding) return null
250+
251+
return typeof funding === 'string' ? funding : funding.url
252+
})
244253
</script>
245254

246255
<template>
@@ -312,6 +321,15 @@ const likeAction = async () => {
312321
</span>
313322
</ButtonBase>
314323
</TooltipApp>
324+
325+
<LinkBase
326+
variant="button-secondary"
327+
v-if="fundingUrl"
328+
:to="fundingUrl"
329+
classicon="i-lucide:handshake text-accent"
330+
>
331+
<span class="max-sm:sr-only">{{ $t('package.links.fund') }}</span>
332+
</LinkBase>
315333
</div>
316334
</div>
317335
</header>

app/components/Package/Skeleton.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<SkeletonBlock class="w-9 md:w-36 h-9 rounded" />
1414
<!-- Likes button placeholder -->
1515
<SkeletonBlock class="w-14 h-9 rounded" />
16+
<!-- Fund link placeholder -->
17+
<SkeletonBlock class="w-22 h-9 rounded self-baseline" />
1618
</div>
1719
</div>
1820
</header>

0 commit comments

Comments
 (0)