feat: use API to fetch sponsors

This commit is contained in:
thomas
2024-03-30 17:40:04 +01:00
parent 37f43a0012
commit bf3866b705

View File

@@ -1,21 +1,22 @@
--- ---
import Default from '@astrojs/starlight/components/Hero.astro'; import Default from '@astrojs/starlight/components/Hero.astro';
import { Icon } from '@astrojs/starlight/components';
import MyIcon from './MyIcon.astro'; import MyIcon from './MyIcon.astro';
const sponsors = ['ddotx'];
const sponsorFetch = await fetch('https://ghs.vercel.app/v2/sponsors/tomalaforge');
const { sponsors } = await sponsorFetch.json();
--- ---
<div class="sponsor-header button-hover"> <div class="sponsor-header button-hover">
<p>Big thanks to the people supporting this project: <p>Big thanks to the people supporting this project:
{sponsors.map((sponsor: string) => ( {sponsors.past.map(({username, avatar}) => (
<a href=`https://github.com/${sponsor}`> <a href=`https://github.com/${username}`>
<img <img
loading="lazy" loading="lazy"
src={`https://github.com/${sponsor}.png?size=80`} src={avatar}
width="40" width="40"
height="40" height="40"
alt={sponsor} alt={username}
class="avatar" class="avatar"
/> />
</a> </a>