Skip to content
This repository was archived by the owner on Jul 11, 2024. It is now read-only.

Commit 78bdf15

Browse files
committed
Update Cards Styles
1 parent 5776b1c commit 78bdf15

File tree

3 files changed

+60
-18
lines changed

3 files changed

+60
-18
lines changed

src/components/CardList.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,22 @@ const PeopleCard = (props) => {
5555
};
5656

5757
const CardList = () => {
58+
const half = Math.ceil(contributors.length / 2);
59+
const firstHalf = contributors.slice(0, half);
60+
const secondHalf = contributors.slice(half);
5861
return (
59-
<>
60-
<h2 style={{ textAlign: "center",margin:'0.5rem' }}>People</h2>
61-
<div className={styles.peopleContainer}>
62-
{contributors.map((person, index) => {
63-
return <PeopleCard key={index} {...person} />;
64-
})}
62+
<div className={styles.mainContainer}>
63+
<div className={styles.column}>
64+
{firstHalf.map((person, index) => (
65+
<PeopleCard key={index} {...person} />
66+
))}
6567
</div>
66-
</>
68+
<div className={styles.column}>
69+
{secondHalf.map((person, index) => (
70+
<PeopleCard key={index} {...person} />
71+
))}
72+
</div>
73+
</div>
6774
);
6875
};
6976
export default CardList;

src/components/people.module.css

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1-
.peopleContainer {
1+
.card {
2+
margin: 2rem;
3+
max-width: 400px;
4+
flex: 1 1 auto;
5+
}
6+
7+
.mainContainer {
28
display: flex;
3-
flex-wrap: wrap;
49
justify-content: center;
510
align-items: center;
6-
margin: 2rem 0;
11+
margin: 0;
12+
padding: 0 5rem;
13+
max-width: 100%;
714
}
8-
.card {
9-
margin: 2rem 4rem;
10-
max-width: 400px;
11-
flex: 1 1 auto;
15+
16+
.column {
17+
display: flex;
18+
flex-direction: column;
19+
align-items: center;
20+
flex: 1;
21+
margin: 0 1rem;
1222
}
23+
24+
@media (max-width: 768px) {
25+
.mainContainer {
26+
flex-direction: column;
27+
padding: 0;
28+
}
29+
30+
.column {
31+
margin: 0;
32+
width: 100%;
33+
}
34+
}

src/pages/alumni.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,32 @@ const PeopleCard = (props) => {
5656
};
5757

5858
const Alumni = () => {
59+
// Splitting the projectAlumni array into two
60+
const half = Math.ceil(projectAlumni.length / 2);
61+
const firstHalf = projectAlumni.slice(0, half);
62+
const secondHalf = projectAlumni.slice(half);
63+
5964
return (
6065
<Layout title="people">
6166
<div>
6267
<h2 style={{ textAlign: "center", margin: "0.5rem" }}>
6368
Project Alumni
6469
</h2>
65-
<div className={styles.peopleContainer}>
66-
{projectAlumni.map((person, index) => {
67-
return <PeopleCard key={index} {...person} />;
68-
})}
70+
<div className={styles.mainContainer}>
71+
<div className={styles.column}>
72+
{firstHalf.map((person, index) => (
73+
<PeopleCard key={index} {...person} />
74+
))}
75+
</div>
76+
<div className={styles.column}>
77+
{secondHalf.map((person, index) => (
78+
<PeopleCard key={index} {...person} />
79+
))}
80+
</div>
6981
</div>
7082
</div>
7183
</Layout>
7284
);
7385
};
86+
7487
export default Alumni;

0 commit comments

Comments
 (0)