Skip to content

Commit 0ba3e5d

Browse files
Merge pull request #17 from SatyaRajAwasth1/year_faculty-wise-page
Fix isues with uniformity
2 parents 9bbb1ec + 1616e25 commit 0ba3e5d

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

src/pages/profiles/[...slug].astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const similarProfiles = allProfiles.filter((p) => p.slug !== entry.slug).slice(0
106106
<div class="text-center mt-12">
107107
<a
108108
href="/profiles"
109-
class="border border-green-500 hover:bg-green-500 text-white py-3 px-6 transition-all duration-300"
109+
class="border border-blue-500 hover:bg-blue-500 text-white py-3 px-6 transition-all duration-300"
110110
>
111111
View All Alumni
112112
</a>

src/pages/profiles/index.astro

+33-20
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
import { getCollection } from "astro:content";
33
import TwoColLayout from "../../layout/TwoColLayout.astro";
4-
import ProfileCard from '../../layout/AlumniCardLayout.astro';
4+
import ProfileCard from "../../layout/AlumniCardLayout.astro";
55
6-
const allProfiles = await getCollection('profiles');
6+
const allProfiles = await getCollection("profiles");
77
88
// A map to hold data in map with year/batch as key and set of profiles in alphabetical order as value
99
const batchMap = allProfiles.reduce((map, profile) => {
@@ -21,9 +21,9 @@ const batchMap = allProfiles.reduce((map, profile) => {
2121
// Convert each set to an array and sort by name
2222
for (const [batch, profilesSet] of batchMap.entries()) {
2323
const profilesArray = Array.from(profilesSet);
24-
24+
2525
profilesArray.sort((a, b) => a.data.name.localeCompare(b.data.name));
26-
26+
2727
// Replace the set with the sorted array in the map
2828
batchMap.set(batch, profilesArray);
2929
}
@@ -33,24 +33,37 @@ const sortedYears = Array.from(batchMap.keys()).sort();
3333
---
3434

3535
<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) => (
4853
<ProfileCard slug={profile.slug} {...profile.data} />
4954
))}
55+
</div>
5056
</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>
5468
</section>
5569
</TwoColLayout>
56-

0 commit comments

Comments
 (0)