1
1
---
2
2
import { getCollection } from " astro:content" ;
3
3
import TwoColLayout from " ../../layout/TwoColLayout.astro" ;
4
- import ProfileCard from ' ../../layout/AlumniCardLayout.astro' ;
4
+ import ProfileCard from " ../../layout/AlumniCardLayout.astro" ;
5
5
6
- const allProfiles = await getCollection (' profiles' );
6
+ const allProfiles = await getCollection (" profiles" );
7
7
8
8
// A map to hold data in map with year/batch as key and set of profiles in alphabetical order as value
9
9
const batchMap = allProfiles .reduce ((map , profile ) => {
@@ -21,9 +21,9 @@ const batchMap = allProfiles.reduce((map, profile) => {
21
21
// Convert each set to an array and sort by name
22
22
for (const [batch, profilesSet] of batchMap .entries ()) {
23
23
const profilesArray = Array .from (profilesSet );
24
-
24
+
25
25
profilesArray .sort ((a , b ) => a .data .name .localeCompare (b .data .name ));
26
-
26
+
27
27
// Replace the set with the sorted array in the map
28
28
batchMap .set (batch , profilesArray );
29
29
}
@@ -33,24 +33,37 @@ const sortedYears = Array.from(batchMap.keys()).sort();
33
33
---
34
34
35
35
<TwoColLayout >
36
- <section class =" bg-gray-900 text-white p-4 sm:p-6 lg:p-8 max-h-screen overflow-y-auto" >
37
- { sortedYears .map ((year ) => {
38
- let showAll = false ;
39
-
40
- return (
41
- <div class = " mb-8" >
42
- <h3 class = " text-lg sm:text-xl lg:text-2xl font-bold flex items-center justify-between" >
43
- { year } Batch
44
- </h3 >
45
- <div class = " grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4 mt-4" >
46
- { (showAll ? batchMap .get (year ) : batchMap .get (year ).slice (0 , 3 ))
47
- .map ((profile ) => (
36
+ <section
37
+ class =" bg-gray-900 text-white p-4 sm:p-6 lg:p-8 max-h-screen overflow-y-auto"
38
+ >
39
+ {
40
+ sortedYears .map ((year ) => {
41
+ let showAll = false ;
42
+
43
+ return (
44
+ <div class = " mb-8" >
45
+ <h3 class = " text-lg sm:text-xl lg:text-2xl font-bold flex items-center justify-between" >
46
+ { year } Batch
47
+ </h3 >
48
+ <div class = " grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4 mt-4" >
49
+ { (showAll
50
+ ? batchMap .get (year )
51
+ : batchMap .get (year ).slice (0 , 3 )
52
+ ).map ((profile ) => (
48
53
<ProfileCard slug = { profile .slug } { ... profile .data } />
49
54
))}
55
+ </div >
50
56
</div >
51
- </div >
52
- );
53
- })}
57
+ );
58
+ })
59
+ }
60
+ <div class =" text-center mt-12" >
61
+ <a
62
+ href =" /"
63
+ class =" border border-blue-500 hover:bg-blue-500 text-white py-3 px-6 transition-all duration-300"
64
+ >
65
+ Get Back to Home
66
+ </a >
67
+ </div >
54
68
</section >
55
69
</TwoColLayout >
56
-
0 commit comments