1
1
import Image from 'next/image'
2
+ import { useState } from 'react' ;
2
3
3
4
const people : string [ ] [ ] = [
4
5
[ "Alex Gomez" , "alexgomez9" ] ,
@@ -76,7 +77,7 @@ function replace(e: React.SyntheticEvent<HTMLImageElement>): void{
76
77
e . currentTarget . onerror = null ;
77
78
e . currentTarget . src = "/profileFallback.png"
78
79
}
79
-
80
+
80
81
export default function People ( ) : JSX . Element {
81
82
return (
82
83
< div className = "bg-white" >
@@ -85,31 +86,49 @@ function replace(e: React.SyntheticEvent<HTMLImageElement>): void{
85
86
< div className = "space-y-5 sm:mx-auto sm:max-w-xl sm:space-y-4 lg:max-w-5xl" >
86
87
< h2 className = "text-3xl font-bold tracking-tight sm:text-4xl" > Our Contributors</ h2 >
87
88
< p className = "text-xl text-gray-500" >
88
- { /* Risus velit condimentum vitae tincidunt tincidunt. Mauris ridiculus fusce amet urna nunc. Ut nisl ornare
89
- diam in. */ }
89
+ All of the people who make Reactime awesome!
90
90
</ p >
91
91
</ div >
92
92
< ul
93
93
role = "list"
94
94
className = "mx-auto grid grid-cols-2 gap-x-8 gap-y-8 sm:grid-cols-4 md:gap-x-6 lg:max-w-5xl lg:gap-x-8 lg:gap-y-12 xl:grid-cols-8"
95
95
>
96
- { people . map ( ( person ) => person && (
97
- < li key = { person [ 1 ] } >
98
- < div className = "space-y-4" >
99
- < img className = "mx-auto h-20 w-20 rounded-full lg:h-24 lg:w-24" src = { `https://github.com/${ person [ 1 ] } .png` } onError = { ( e ) => replace ( e ) } />
100
- < div className = "space-y-2" >
101
- < div className = "text-xs font-medium lg:text-sm" >
102
- < h3 > { person [ 0 ] } </ h3 >
103
- < a href = { `https://github.com/${ person [ 1 ] } ` } className = "text-rose-500" > { person [ 1 ] } </ a >
104
- </ div >
105
- </ div >
106
- </ div >
107
- </ li >
108
- ) ) }
96
+ < >
97
+ { people . map ( ( person ) => (
98
+ < Profile key = { person [ 1 ] } profile = { person [ 1 ] } name = { person [ 0 ] } />
99
+ ) ) }
100
+ </ >
109
101
</ ul >
110
102
</ div >
111
103
</ div >
112
104
</ div >
113
105
)
114
106
}
115
-
107
+ type profileType = {
108
+ profile : string | undefined ,
109
+ name : string | undefined ,
110
+ }
111
+ function Profile ( { profile, name} : profileType ) {
112
+ const [ imageError , setImageError ] = useState ( false ) ;
113
+ return (
114
+ < div className = "space-y-4" >
115
+ < Image
116
+ width = { 100 }
117
+ height = { 100 }
118
+ src = { imageError ? "/profileFallback.png" : 'https://github.com/' + profile + '.png' }
119
+ className = "mx-auto h-20 w-20 rounded-full lg:h-24 lg:w-24"
120
+ onError = { ( e ) => setImageError ( true ) }
121
+ alt = "missing-profile-image"
122
+ />
123
+ < div className = "space-y-2" >
124
+ < div className = "text-xs font-medium lg:text-sm" >
125
+ < h3 > { name } </ h3 >
126
+ < a target = "_blank" href = { `https://github.com/${ profile } ` } className = "text-rose-500" > { profile } </ a >
127
+ </ div >
128
+ </ div >
129
+ </ div >
130
+ )
131
+ }
132
+
133
+
134
+
0 commit comments