@@ -16,8 +16,8 @@ class AlumnusCard extends React.Component<{ name: string, date: string, pos: str
1616 backgroundColor : 'white'
1717 } } >
1818 < div style = { { fontSize : '1.2rem' , fontWeight : 'bold' } } > { this . props . name } </ div >
19- < div style = { { fontSize : '1rem' , marginTop : '0.5rem' , color : 'gray' } } > { this . props . date } </ div >
20- < div style = { { fontSize : "1rem" , color : "gray" , marginTop : "0.5rem" , marginBottom : "0.5rem" } } > { this . props . pos } </ div >
19+ { this . props . date . length > 0 ? < div style = { { fontSize : '1rem' , marginTop : '0.5rem' , color : 'gray' } } > { this . props . date } </ div > : "" }
20+ { this . props . pos . length > 0 ? < div style = { { fontSize : "1rem" , color : "gray" , marginTop : "0.5rem" , marginBottom : "0.5rem" } } > { this . props . pos } </ div > : "" }
2121 < div style = { {
2222 fontSize : '0.8rem' ,
2323 color : 'gray'
@@ -29,23 +29,74 @@ class AlumnusCard extends React.Component<{ name: string, date: string, pos: str
2929 }
3030}
3131
32+ const rowNum = 3 ;
33+ const graduatedPhds = alumni . filter ( ( a ) => a . position === "Graduated PhD" ) ;
34+ const postDocs = alumni . filter ( ( a ) => a . position === "PostDoc" ) ;
35+ const others = alumni . filter ( ( a ) => a . position !== "Graduated PhD" && a . position !== "PostDoc" ) ;
36+
3237export class Alumni extends React . Component < { isVisible : boolean } > {
3338 constructor ( props : { isVisible : boolean } ) {
3439 super ( props ) ;
3540 }
3641 public render ( ) {
37- const alumniGroups = [ ] ;
38- for ( let i = 0 ; i < alumni . length ; i += 3 ) {
39- alumniGroups . push ( alumni . slice ( i , i + 3 ) ) ;
42+ const phdsGroups = [ ] ;
43+ const postDocGroups = [ ] ;
44+ const otherGroups = [ ] ;
45+ for ( let i = 0 ; i < graduatedPhds . length ; i += rowNum ) {
46+ phdsGroups . push ( graduatedPhds . slice ( i , i + rowNum ) ) ;
47+ }
48+ for ( let i = 0 ; i < postDocs . length ; i += rowNum ) {
49+ postDocGroups . push ( postDocs . slice ( i , i + rowNum ) ) ;
50+ }
51+ for ( let i = 0 ; i < others . length ; i += rowNum ) {
52+ otherGroups . push ( others . slice ( i , i + rowNum ) ) ;
4053 }
4154 return (
4255 < div style = { { display : 'flex' , justifyContent : 'center' } } >
4356 {
4457 this . props . isVisible ?
4558 < div >
59+ < div style = { { fontSize : "1.5rem" } } > Graduated PhDs</ div >
60+ < div >
4661 {
47- alumniGroups . map ( ( alumniGroup , _ ) => (
62+ phdsGroups . map ( ( alumniGroup , _ ) => (
4863 < div style = { { display : 'flex' , justifyContent : 'start' } } >
64+ {
65+ alumniGroup . map ( ( alumnus , _ ) => (
66+ alumnus . web . length > 0 ?
67+ < a href = { alumnus . web } >
68+ < AlumnusCard name = { alumnus . name } pos = "" date = { alumnus . date } nxt = { alumnus . next } />
69+ </ a > :
70+ < AlumnusCard name = { alumnus . name } pos = "" date = { alumnus . date } nxt = { alumnus . next } />
71+ ) )
72+ }
73+ </ div >
74+ ) )
75+ }
76+ </ div >
77+ < div style = { { fontSize : "1.5rem" } } > Postdoctoral Researchers</ div >
78+ < div >
79+ {
80+ postDocGroups . map ( ( alumniGroup , _ ) => (
81+ < div style = { { display : 'flex' , justifyContent : 'center' } } >
82+ {
83+ alumniGroup . map ( ( alumnus , _ ) => (
84+ alumnus . web . length > 0 ?
85+ < a href = { alumnus . web } >
86+ < AlumnusCard name = { alumnus . name } pos = "" date = { alumnus . date } nxt = { alumnus . next } />
87+ </ a > :
88+ < AlumnusCard name = { alumnus . name } pos = "" date = { alumnus . date } nxt = { alumnus . next } />
89+ ) )
90+ }
91+ </ div >
92+ ) )
93+ }
94+ </ div >
95+ < div style = { { fontSize : "1.5rem" } } > Others</ div >
96+ < div >
97+ {
98+ otherGroups . map ( ( alumniGroup , _ ) => (
99+ < div style = { { display : 'flex' , justifyContent : 'center' } } >
49100 {
50101 alumniGroup . map ( ( alumnus , _ ) => (
51102 alumnus . web . length > 0 ?
@@ -58,7 +109,8 @@ export class Alumni extends React.Component<{ isVisible: boolean }> {
58109 </ div >
59110 ) )
60111 }
61- </ div > :
112+ </ div >
113+ </ div > :
62114 ""
63115 }
64116 </ div >
0 commit comments