Skip to content

Commit a510659

Browse files
authored
Flattening "committees" page components (#170)
* first pass on flattening * extra comments, rename
1 parent 72f0f12 commit a510659

File tree

21 files changed

+201
-227
lines changed

21 files changed

+201
-227
lines changed

src/App.scss

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
@import 'Base';
55
@import 'components/Navbar/style';
66
@import 'components/Committees/style';
7-
@import 'components/Committees/CommitteesBanner/style';
8-
@import 'components/Committees/SidebarItem/style';
9-
@import 'components/Committees/CommitteeSections/CommitteeSectionHeader/style';
7+
@import 'components/Committees/Sidebar/style';
108
@import 'components/Committees/CommitteeSections/CommitteeSectionIntro/style';
11-
@import 'components/Committees/CommitteeSections/CommitteeSectionBody/style';
12-
@import 'components/Committees/CommitteeSections/CommitteeSectionBody/CommitteeEventCard/style';
9+
@import 'components/Committees/CommitteeSections/CommitteeEventCard/style';
1310
@import 'components/Button/style';
1411
@import 'components/Banner/style';
1512
@import 'components/Home/style';

src/Base.scss

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,74 @@
55
$acm-cobalt: #1E6CFF;
66
$acm-black: #181818;
77
$acm-tint: #3DA2FF;
8-
8+
99
$hack-purple: #C960FF;
1010
$hack-black: #262938;
1111
$hack-tint: #C137D8;
12-
12+
1313
$w-teal: #1BC3A9;
1414
$w-black: #233431;
1515
$w-tint: #56E4B1;
16-
16+
1717
$icpc-tangerine: #FF8383;
1818
$icpc-black: #3A2B2B;
1919
$icpc-tint: #F38F70;
20-
20+
2121
$ai-arctic: #28B2FF;
2222
$ai-black: #233339;
2323
$ai-tint: #35DDF3;
24-
24+
2525
$studio-raspberry: #FB4469;
2626
$studio-black: #39272B;
2727
$studio-tint: #FF8C93;
28-
28+
2929
$cyber-amber: #FFCB44;
3030
$cyber-black: #3A3327;
3131
$cyber-tint: #FFE81A;
32-
32+
3333
$design-orange: #FE8D3C;
3434
$design-black: #372B25;
3535
$design-tint: #FFAC30;
36-
36+
3737
$teachla-green: #5EDA12;
3838
$teachla-black: #2C3022;
3939
$teachla-tint: #B0EE00;
40-
40+
4141
$font-display: 'Poppins', 'Helvetica Neue', 'Helvetica', sans-serif;
4242
$font-header: 'Poppins', sans-serif;
4343
$font-body: 'Open Sans', sans-serif;
44-
44+
4545
$font-primary-color: #333;
4646
$font-secondary-color: #777;
4747

4848
$navbar-breakpoint: 1160px;
49-
49+
5050
body {
5151
color: $font-primary-color;
5252
font-family: $font-body;
5353
margin: 0;
5454
padding: 0;
5555
}
56-
56+
5757
.app-container {
5858
display: flex;
5959
flex-direction: column;
6060
min-height: 100vh;
6161
}
62-
62+
6363
.main-container {
6464
flex: 1 0 auto;
6565
margin-top: 70px; //To account for height of Navbar, which uses fixed positioning
6666
}
67+
68+
.font-header {
69+
font-family: $font-header;
70+
}
71+
72+
.text-bold {
73+
font-weight: bold;
74+
}
75+
76+
.text-25x {
77+
font-size: 2.5em !important;
78+
}

src/components/Committees/CommitteeSections/CommitteeSectionBody/CommitteeEventCard/CommitteeEventCard.js renamed to src/components/Committees/CommitteeSections/CommitteeEventCard/CommitteeEventCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function CommitteeEventCard(props) {
88
? <img src={props.image.src} alt={props.image.alt} />
99
: <img src={`/images/committees/${props.committee}/${props.committee}_motif_base.png`} alt={props.image.alt} />
1010
}
11-
<h2>{props.title}</h2>
11+
<h4 className="font-header text-bold">{props.title}</h4>
1212
{props.desc}
1313
</div>
1414
);

src/components/Committees/CommitteeSections/CommitteeSectionBody/CommitteeEventCard/style.scss renamed to src/components/Committees/CommitteeSections/CommitteeEventCard/style.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
flex-direction: column;
55
margin: 0 1% 2rem;
66
text-align: left;
7-
7+
88
img {
99
height: 160px;
1010
object-fit: cover;
1111
}
1212

13-
h2 {
13+
h4 {
14+
font-size: 1.4em;
1415
margin: 20px 10px 20px 0;
1516
}
1617

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
import React from 'react';
2-
import Body from './CommitteeSectionBody/CommitteeSectionBody';
3-
import Header from './CommitteeSectionHeader/CommitteeSectionHeader';
2+
import CommitteeEventCard from './CommitteeEventCard/CommitteeEventCard';
43
import Intro from './CommitteeSectionIntro/CommitteeSectionIntro';
54

6-
function CommitteeSection(props) {
5+
function CommitteeProjects({committee}) {
76
return (
8-
<div id={props.committee.class} className='committee-section'>
9-
<Header committee={props.committee}/>
10-
<Intro committee={props.committee}/>
11-
<Body committee={props.committee}/>
7+
<div className="body-wrapper">
8+
<h3 className="font-header text-bold text-25x">Events and Projects</h3>
9+
<div className="card-container">
10+
{committee.infoCards.map((card) => {
11+
// TODO: destructure class after renaming it
12+
const { image, title, desc } = card;
13+
return (
14+
<CommitteeEventCard
15+
committee={committee.class}
16+
image={image}
17+
title={title}
18+
desc={desc}
19+
key={title}
20+
/>
21+
);
22+
})}
23+
</div>
1224
</div>
1325
);
1426
}
1527

28+
function CommitteeSection(props) {
29+
const { committee } = props;
30+
// TODO: destructure committee after renaming the .class property
31+
return (
32+
<div id={committee.class} className="committee-section">
33+
{/* Header image */}
34+
{/* TODO: this could probably be a bit more accessible */}
35+
<div className={`committee-header ${committee.class}`}>
36+
<img src={committee.image} alt="committee logo" />
37+
</div>
38+
{/* Committee Intro */}
39+
<Intro committee={committee} />
40+
{/* Committee Body: events & projects */}
41+
<CommitteeProjects committee={committee} />
42+
</div>
43+
);
44+
}
45+
1646
export default CommitteeSection;

src/components/Committees/CommitteeSections/CommitteeSectionBody/CommitteeSectionBody.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/components/Committees/CommitteeSections/CommitteeSectionBody/style.scss

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/components/Committees/CommitteeSections/CommitteeSectionHeader/CommitteeSectionHeader.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/components/Committees/CommitteeSections/CommitteeSectionHeader/style.scss

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components/Committees/CommitteeSections/CommitteeSectionIntro/CommitteeSectionIntro.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function CommitteeIconLink({committee, link}) {
2525
);
2626
}
2727

28+
// TODO: down the line, this can be refactored into a utility!
2829
function CommitteeIcon({platform}) {
2930
// see https://fontawesome.com/how-to-use/on-the-web/other-topics/accessibility#web-fonts-semantic
3031
// for more on accessibility
@@ -45,10 +46,12 @@ function CommitteeIcon({platform}) {
4546
}
4647
}
4748

49+
// TODO: props destructuring
4850
function CommitteeSectionIntro(props) {
4951
return (
5052
<div className="intro-row">
5153
<div className="show-mobile">
54+
{/* TODO: this should have an alt tag */}
5255
<img src={props.committee.introImage} alt=""/>
5356
<p>{props.committee.introImageDesc}</p>
5457
</div>
@@ -62,6 +65,7 @@ function CommitteeSectionIntro(props) {
6265
)}
6366
</div>
6467
</div>
68+
{/* TODO: we can easily refactor this with the above .show-mobile to reduce code dupe */}
6569
<div className="right-col">
6670
<img src={props.committee.introImage} alt=""/>
6771
<p>{props.committee.introImageDesc}</p>

0 commit comments

Comments
 (0)