Skip to content

Commit 20b91c4

Browse files
committed
docs: make sponsors dynamic
1 parent 08dcd59 commit 20b91c4

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup lang="ts">
2+
import { onMounted, ref } from 'vue';
3+
4+
const svgUrl = 'https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg';
5+
const svgContent = ref<string>('');
6+
7+
const fetchSvg = async () => {
8+
const response = await fetch(svgUrl);
9+
const svgText = await response.text();
10+
svgContent.value = svgText.replace('<svg ', '<svg style="width:100%;height:auto;" ');
11+
};
12+
13+
onMounted(() => {
14+
fetchSvg();
15+
});
16+
</script>
17+
18+
<template>
19+
<div
20+
v-if="svgContent"
21+
v-html="svgContent"
22+
/>
23+
<a
24+
v-else
25+
href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984"
26+
target="_blank"
27+
>
28+
<img :src="svgUrl">
29+
</a>
30+
</template>

docs/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,12 @@ If your company uses _tsx_ and would like to support the project, consider [spon
158158
## Sponsors
159159

160160
<p align="center">
161-
<a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984" target="_blank">
162-
<img src="https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg">
163-
</a>
161+
<Sponsors />
164162
<a class="button sponsor-button mt-10 mx-auto" href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984" target="_blank">
165163
Become a sponsor
166164
</a>
167165
</p>
168166

169-
<script setup lang="ts">
170-
import ImageLink from './.vitepress/theme/components/ImageLink.vue';
171-
import Marquee from './.vitepress/theme/components/Marquee.vue';
172-
</script>
173-
174167
<style scoped>
175168
.tsx-before-after {
176169
@apply
@@ -202,3 +195,9 @@ import Marquee from './.vitepress/theme/components/Marquee.vue';
202195
;
203196
}
204197
</style>
198+
199+
<script setup lang="ts">
200+
import ImageLink from './.vitepress/theme/components/ImageLink.vue';
201+
import Marquee from './.vitepress/theme/components/Marquee.vue';
202+
import Sponsors from './.vitepress/theme/components/Sponsors.vue';
203+
</script>

0 commit comments

Comments
 (0)