generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 161
/
Copy pathsponsors.tsx
160 lines (156 loc) · 4.49 KB
/
sponsors.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import { Button } from '@/src/components/ui/button'
import { Heart } from 'lucide-react'
import Image from 'next/image'
import { ReactNode } from 'react'
import { z } from 'zod'
export async function SponsorsSection() {
const sponsors = await fetchSponsors()
return (
<section className="mb-24">
<h2 className="mb-12 text-center text-3xl font-bold tracking-tighter dark:text-white md:text-4xl xl:text-5xl">
Sponsors
</h2>
<ul className="container grid grid-cols-2 gap-y-12 md:grid-cols-4">
{sponsors.map(sponsor => (
<li key={sponsor.handle} className="flex flex-col items-center">
<a href={sponsor.url} className="h-32 w-32 rounded-full">
<Image
src={sponsor.img}
alt={sponsor.name ?? sponsor.handle}
className="mx-auto size-28 rounded-full"
width={128}
height={128}
/>
</a>
<a
href={sponsor.url}
className="mt-2 inline-block font-semibold hover:underline"
>
{sponsor.name ?? sponsor.handle}
</a>
{Boolean(sponsor.title) && (
<span className="mt-1 inline-block text-sm text-zinc-500">
{sponsor.title}
</span>
)}
</li>
))}
</ul>
<div className="mt-16 flex justify-center">
<Button className="text-md mx-auto font-semibold" asChild size="lg">
<a href="https://github.com/sponsors/franky47">
<Heart className="mr-2 stroke-pink-500" size={18} /> Sponsor my work
</a>
</Button>
</div>
</section>
)
}
// --
const sponsorSchema = z.object({
name: z.string().nullish(),
handle: z.string(),
url: z.string().url(),
img: z.string().url(),
title: z.custom<ReactNode>()
})
type Sponsors = z.infer<typeof sponsorSchema>[]
async function fetchSponsors(): Promise<Sponsors> {
// GraphQL query (might take time to configure two tokens with correct scopes
// to do this automatically, but right now CBA).
// {
// user(login: "franky47") {
// sponsors(first: 100) {
// nodes {
// ... on User {
// handle: login
// name
// url
// img: avatarUrl
// }
// ... on Organization {
// handle: login
// name
// url
// img: avatarUrl
// }
// }
// }
// }
// }
return [
{
handle: 'vercel',
name: 'Vercel',
url: 'https://vercel.com/',
img: 'https://avatars.githubusercontent.com/u/14985020?v=4'
},
{
handle: 'unkey.com',
name: 'Unkey',
url: 'https://unkey.com',
img: 'https://avatars.githubusercontent.com/u/138932600?s=200&v=4'
},
{
handle: 'openstatus.dev',
name: 'OpenStatus',
url: 'https://openstatus.dev',
img: 'https://avatars.githubusercontent.com/u/136892265?s=200&v=4'
},
{
handle: 'ryanmagoon',
name: 'Ryan Magoon',
url: 'https://x.com/Ryan_Magoon',
img: 'https://avatars.githubusercontent.com/u/5327290?v=4'
},
{
handle: 'pontusab',
name: 'Pontus Abrahamsson',
url: 'https://x.com/pontusab',
img: 'https://avatars.githubusercontent.com/u/655158?v=4',
title: (
<>
Founder of{' '}
<a href="https://midday.ai" className="hover:underline">
Midday.ai
</a>
</>
)
},
{
handle: 'CarlLindesvard',
name: 'Carl Lindesvärd',
url: 'https://x.com/CarlLindesvard',
img: 'https://pbs.twimg.com/profile_images/1751607056316944384/8E4F88FL_400x400.jpg',
title: (
<>
Founder of{' '}
<a href="https://openpanel.dev" className="hover:underline">
OpenPanel
</a>
</>
)
},
{
handle: 'rwieruch',
name: 'Robin Wieruch',
url: 'https://www.robinwieruch.de/',
img: 'https://avatars.githubusercontent.com/u/2479967?v=4',
title: (
<>
Author of{' '}
<a href="https://www.road-to-next.com/" className="hover:underline">
The Road to Next
</a>
</>
)
},
{
handle: 'YoannFleuryDev',
name: 'Yoann Fleury',
url: 'https://www.yoannfleury.dev/',
img: 'https://pbs.twimg.com/profile_images/1594632934245498880/CJTKNRCO_400x400.jpg',
title: 'Front end developer'
}
]
}