Skip to content

Commit 3476c47

Browse files
authored
feat(package): add fund button (#233)
1 parent 6b11eb6 commit 3476c47

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

app/pages/[...package].vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ const docsLink = computed(() => {
183183
}
184184
})
185185
186+
const fundingUrl = computed(() => {
187+
let funding = displayVersion.value?.funding
188+
if (Array.isArray(funding)) funding = funding[0]
189+
190+
if (!funding) return null
191+
192+
return typeof funding === 'string' ? funding : funding.url
193+
})
194+
186195
function normalizeGitUrl(url: string): string {
187196
return url
188197
.replace(/^git\+/, '')
@@ -635,6 +644,15 @@ defineOgImageComponent('Package', {
635644
{{ $t('package.links.docs') }}
636645
</NuxtLink>
637646
</li>
647+
<li v-if="fundingUrl">
648+
<NuxtLink
649+
:to="fundingUrl"
650+
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
651+
>
652+
<span class="i-carbon-favorite w-4 h-4" aria-hidden="true" />
653+
{{ $t('package.links.fund') }}
654+
</NuxtLink>
655+
</li>
638656
<li v-if="displayVersion" class="sm:ml-auto">
639657
<NuxtLink
640658
:to="{

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
"forks": "fork | forks",
105105
"jsr": "jsr",
106106
"code": "code",
107-
"docs": "docs"
107+
"docs": "docs",
108+
"fund": "fund"
108109
},
109110
"install": {
110111
"title": "Install",

i18n/locales/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@
102102
"forks": "复刻",
103103
"jsr": "jsr",
104104
"code": "代码",
105-
"docs": "文档"
105+
"docs": "文档",
106+
"fund": "资助"
106107
},
107108
"install": {
108109
"title": "安装",

0 commit comments

Comments
 (0)