@@ -113,6 +113,80 @@ function LibraryBadge({ library }: { library: Library }) {
113
113
)
114
114
}
115
115
116
+ const MaintainerSocialIcons : Record <
117
+ keyof Maintainer [ 'social' ] ,
118
+ React . ReactNode
119
+ > = {
120
+ twitter : (
121
+ < svg
122
+ viewBox = "0 0 24 24"
123
+ className = "w-5 h-5"
124
+ fill = "currentColor"
125
+ aria-hidden = "true"
126
+ >
127
+ < path d = "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
128
+ </ svg >
129
+ ) ,
130
+ bluesky : (
131
+ < svg
132
+ viewBox = "0 0 24 21"
133
+ className = "w-5 h-5"
134
+ fill = "currentColor"
135
+ aria-hidden = "true"
136
+ >
137
+ < path d = "M5.20238 1.4019C7.95375 3.43816 10.9136 7.56632 12 9.78164V15.6329C12 15.5084 11.9513 15.6491 11.8463 15.9523C11.2793 17.594 9.0645 24.0012 4.00012 18.8791C1.3335 16.1822 2.568 13.4854 7.422 12.6712C4.64512 13.1368 1.52325 12.3672 0.66675 9.34985C0.42 8.48185 0 3.13532 0 2.41322C0 -1.20394 3.21712 -0.066993 5.20238 1.4019ZM18.7976 1.4019C16.0462 3.43816 13.0864 7.56632 12 9.78164V15.6329C12 15.5084 12.0487 15.6491 12.1537 15.9523C12.7207 17.594 14.9355 24.0012 19.9999 18.8791C22.6665 16.1822 21.432 13.4854 16.578 12.6712C19.3549 13.1368 22.4768 12.3672 23.3333 9.34985C23.58 8.48185 24 3.13532 24 2.41322C24 -1.20394 20.7832 -0.066993 18.7976 1.4019Z" />
138
+ </ svg >
139
+ ) ,
140
+ website : (
141
+ < svg
142
+ viewBox = "0 0 24 24"
143
+ className = "w-5 h-5"
144
+ fill = "currentColor"
145
+ aria-hidden = "true"
146
+ >
147
+ < path d = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" />
148
+ </ svg >
149
+ ) ,
150
+ github : (
151
+ < svg
152
+ viewBox = "0 0 16 16"
153
+ className = "w-5 h-5"
154
+ fill = "currentColor"
155
+ aria-hidden = "true"
156
+ >
157
+ < path d = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" > </ path >
158
+ </ svg >
159
+ ) ,
160
+ }
161
+
162
+ function MaintainerSocialLinks ( { maintainer } : { maintainer : Maintainer } ) {
163
+ const links = Object . entries ( {
164
+ github : `https://github.com/${ maintainer . github } ` ,
165
+ ...( maintainer . social || { } ) ,
166
+ } ) . map ( ( [ key , value ] ) => {
167
+ const Icon = MaintainerSocialIcons [ key as keyof Maintainer [ 'social' ] ]
168
+ return (
169
+ < a
170
+ key = { key }
171
+ href = { value }
172
+ target = "_blank"
173
+ rel = "noopener noreferrer"
174
+ aria-label = { key }
175
+ onClick = { ( e ) => e . stopPropagation ( ) }
176
+ className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -mb-2 -ml-2 hover:grayscale-0 hover:scale-110"
177
+ >
178
+ { Icon }
179
+ </ a >
180
+ )
181
+ } )
182
+
183
+ return (
184
+ < div className = "flex flex-wrap items-center gap-x-2 sm:gap-x-4 gap-y-2 text-gray-400 dark:text-gray-500 pt-1" >
185
+ { links }
186
+ </ div >
187
+ )
188
+ }
189
+
116
190
interface MaintainerCardProps {
117
191
maintainer : Maintainer
118
192
libraryId ?: Library [ 'id' ]
@@ -205,77 +279,7 @@ export function MaintainerCard({ maintainer, libraryId }: MaintainerCardProps) {
205
279
) }
206
280
</ div >
207
281
) }
208
- < div className = "flex items-center space-x-4 text-gray-400 dark:text-gray-500 [&>*]:grayscale pt-1" >
209
- < a
210
- href = { `https://github.com/${ maintainer . github } ` }
211
- className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -m-2 hover:grayscale-0"
212
- target = "_blank"
213
- rel = "noopener noreferrer"
214
- aria-label = "GitHub profile"
215
- onClick = { ( e ) => e . stopPropagation ( ) }
216
- >
217
- < svg
218
- viewBox = "0 0 16 16"
219
- className = "w-5 h-5"
220
- fill = "currentColor"
221
- aria-hidden = "true"
222
- >
223
- < path d = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" > </ path >
224
- </ svg >
225
- </ a >
226
- { maintainer . social ?. twitter && (
227
- < a
228
- href = { maintainer . social . twitter }
229
- className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -m-2 hover:grayscale-0"
230
- target = "_blank"
231
- rel = "noopener noreferrer"
232
- aria-label = "Twitter profile"
233
- onClick = { ( e ) => e . stopPropagation ( ) }
234
- >
235
- < svg
236
- viewBox = "0 0 24 24"
237
- className = "w-5 h-5"
238
- fill = "currentColor"
239
- aria-hidden = "true"
240
- >
241
- < path d = "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
242
- </ svg >
243
- </ a >
244
- ) }
245
- { maintainer . social ?. bluesky && (
246
- < a
247
- href = { maintainer . social . bluesky }
248
- className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -m-2 hover:grayscale-0"
249
- target = "_blank"
250
- rel = "noopener noreferrer"
251
- aria-label = "Bluesky profile"
252
- onClick = { ( e ) => e . stopPropagation ( ) }
253
- >
254
- < span className = "text-lg" aria-hidden = "true" >
255
- 🦋
256
- </ span >
257
- </ a >
258
- ) }
259
- { maintainer . social ?. website && (
260
- < a
261
- href = { maintainer . social . website }
262
- className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -m-2 hover:grayscale-0"
263
- target = "_blank"
264
- rel = "noopener noreferrer"
265
- aria-label = "Personal website"
266
- onClick = { ( e ) => e . stopPropagation ( ) }
267
- >
268
- < svg
269
- viewBox = "0 0 24 24"
270
- className = "w-5 h-5"
271
- fill = "currentColor"
272
- aria-hidden = "true"
273
- >
274
- < path d = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" />
275
- </ svg >
276
- </ a >
277
- ) }
278
- </ div >
282
+ < MaintainerSocialLinks maintainer = { maintainer } />
279
283
</ div >
280
284
</ div >
281
285
)
0 commit comments