@@ -6,9 +6,17 @@ import {
66} from '~/libraries/maintainers'
77import { useState } from 'react'
88
9- function RoleBadge ( { role } : { role : string } ) {
9+ function RoleBadge ( {
10+ maintainer,
11+ libraryId,
12+ } : {
13+ maintainer : Maintainer
14+ libraryId ?: Library [ 'id' ]
15+ } ) {
16+ const role = libraryId ? getRoleInLibrary ( maintainer , libraryId ) : ''
1017 const isCreator = role . toLowerCase ( ) . includes ( 'creator' )
1118 const isMaintainer = role . toLowerCase ( ) . includes ( 'maintainer' )
19+ const isCoreMaintainer = isMaintainer && maintainer . isCoreMaintainer
1220
1321 if ( isCreator ) {
1422 return (
@@ -20,7 +28,13 @@ function RoleBadge({ role }: { role: string }) {
2028
2129 if ( isMaintainer ) {
2230 return (
23- < span className = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-500 text-white" >
31+ < span
32+ className = { `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${
33+ isCoreMaintainer
34+ ? 'bg-gradient-to-r from-blue-400 to-blue-700 text-white shadow border border-blue-300'
35+ : 'bg-blue-500 text-white'
36+ } `}
37+ >
2438 { role }
2539 </ span >
2640 )
@@ -71,14 +85,18 @@ function SpecialtyChip({ specialty }: { specialty: string }) {
7185
7286function LibraryBadge ( { library } : { library : Library } ) {
7387 return (
74- < span
88+ < a
89+ href = { `/${ library . id } /latest/docs/contributors` }
7590 className = { `inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold text-green-900 dark:text-green-200 ${
7691 library . bgStyle ?? 'bg-gray-500'
77- } bg-opacity-40 dark:bg-opacity-30 capitalize`}
78- aria-label = { `Library: ${ library . name } ` }
92+ } bg-opacity-40 dark:bg-opacity-30 capitalize hover:underline focus:outline-none focus:ring-2 focus:ring-blue-400 transition-colors`}
93+ aria-label = { `View contributors for ${ library . name } ` }
94+ tabIndex = { 0 }
95+ onClick = { ( e ) => e . stopPropagation ( ) }
96+ title = { `View all contributors for ${ library . name } ` }
7997 >
8098 { library . name . replace ( 'TanStack' , '🌴' ) }
81- </ span >
99+ </ a >
82100 )
83101}
84102
@@ -92,14 +110,18 @@ export function MaintainerCard({ maintainer, libraryId }: MaintainerCardProps) {
92110 const [ showAllLibraries , setShowAllLibraries ] = useState ( false )
93111
94112 return (
95- < a
96- href = { `https://github.com/${ maintainer . github } ` }
113+ < div
97114 className = "group bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-lg"
98- target = "_blank"
99- rel = "noopener noreferrer"
100- aria-label = { `View ${ maintainer . name } 's GitHub profile` }
115+ aria-label = { `Maintainer card for ${ maintainer . name } ` }
101116 >
102- < div className = "relative h-64 overflow-hidden" >
117+ < a
118+ href = { `https://github.com/${ maintainer . github } ` }
119+ target = "_blank"
120+ rel = "noopener noreferrer"
121+ aria-label = { `View ${ maintainer . name } 's GitHub profile` }
122+ className = "relative h-64 overflow-hidden block"
123+ tabIndex = { 0 }
124+ >
103125 < img
104126 alt = { `Avatar of ${ maintainer . name } ` }
105127 className = "w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
@@ -131,10 +153,23 @@ export function MaintainerCard({ maintainer, libraryId }: MaintainerCardProps) {
131153 ) }
132154 </ div >
133155 </ div >
134- </ div >
156+ </ a >
135157 < div className = "p-3 space-y-2" >
158+ < div className = "flex items-center justify-between" >
159+ < span
160+ className = "text-base font-bold"
161+ id = { `maintainer-name-${ maintainer . github } ` }
162+ >
163+ { maintainer . name }
164+ </ span >
165+ < div className = "flex items-center gap-2" >
166+ { libraryId && (
167+ < RoleBadge maintainer = { maintainer } libraryId = { libraryId } />
168+ ) }
169+ </ div >
170+ </ div >
136171 { ! libraryId && libraries . length > 0 && (
137- < div className = "flex flex-wrap gap-1.5" >
172+ < div className = "flex flex-wrap gap-1.5 pt-1 " >
138173 { libraries
139174 . slice ( 0 , showAllLibraries ? undefined : 2 )
140175 . map ( ( library ) => (
@@ -157,18 +192,7 @@ export function MaintainerCard({ maintainer, libraryId }: MaintainerCardProps) {
157192 ) }
158193 </ div >
159194 ) }
160- < div className = "flex items-center justify-between" >
161- < h3
162- className = "text-base font-bold"
163- id = { `maintainer-name-${ maintainer . github } ` }
164- >
165- { maintainer . name }
166- </ h3 >
167- { libraryId && (
168- < RoleBadge role = { getRoleInLibrary ( maintainer , libraryId ) } />
169- ) }
170- </ div >
171- < div className = "flex items-center space-x-4 text-gray-400 dark:text-gray-500 [&>*]:grayscale" >
195+ < div className = "flex items-center space-x-4 text-gray-400 dark:text-gray-500 [&>*]:grayscale pt-1" >
172196 < a
173197 href = { `https://github.com/${ maintainer . github } ` }
174198 className = "hover:text-gray-700 dark:hover:text-gray-200 transition-colors p-2 -m-2 hover:grayscale-0"
@@ -240,6 +264,6 @@ export function MaintainerCard({ maintainer, libraryId }: MaintainerCardProps) {
240264 ) }
241265 </ div >
242266 </ div >
243- </ a >
267+ </ div >
244268 )
245269}
0 commit comments