Skip to content

Commit

Permalink
Flattening "committees" page components (#170)
Browse files Browse the repository at this point in the history
* first pass on flattening

* extra comments, rename
  • Loading branch information
mattxwang committed Jun 15, 2021
1 parent 72f0f12 commit a510659
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 227 deletions.
7 changes: 2 additions & 5 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
@import 'Base';
@import 'components/Navbar/style';
@import 'components/Committees/style';
@import 'components/Committees/CommitteesBanner/style';
@import 'components/Committees/SidebarItem/style';
@import 'components/Committees/CommitteeSections/CommitteeSectionHeader/style';
@import 'components/Committees/Sidebar/style';
@import 'components/Committees/CommitteeSections/CommitteeSectionIntro/style';
@import 'components/Committees/CommitteeSections/CommitteeSectionBody/style';
@import 'components/Committees/CommitteeSections/CommitteeSectionBody/CommitteeEventCard/style';
@import 'components/Committees/CommitteeSections/CommitteeEventCard/style';
@import 'components/Button/style';
@import 'components/Banner/style';
@import 'components/Home/style';
Expand Down
38 changes: 25 additions & 13 deletions src/Base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,74 @@
$acm-cobalt: #1E6CFF;
$acm-black: #181818;
$acm-tint: #3DA2FF;

$hack-purple: #C960FF;
$hack-black: #262938;
$hack-tint: #C137D8;

$w-teal: #1BC3A9;
$w-black: #233431;
$w-tint: #56E4B1;

$icpc-tangerine: #FF8383;
$icpc-black: #3A2B2B;
$icpc-tint: #F38F70;

$ai-arctic: #28B2FF;
$ai-black: #233339;
$ai-tint: #35DDF3;

$studio-raspberry: #FB4469;
$studio-black: #39272B;
$studio-tint: #FF8C93;

$cyber-amber: #FFCB44;
$cyber-black: #3A3327;
$cyber-tint: #FFE81A;

$design-orange: #FE8D3C;
$design-black: #372B25;
$design-tint: #FFAC30;

$teachla-green: #5EDA12;
$teachla-black: #2C3022;
$teachla-tint: #B0EE00;

$font-display: 'Poppins', 'Helvetica Neue', 'Helvetica', sans-serif;
$font-header: 'Poppins', sans-serif;
$font-body: 'Open Sans', sans-serif;

$font-primary-color: #333;
$font-secondary-color: #777;

$navbar-breakpoint: 1160px;

body {
color: $font-primary-color;
font-family: $font-body;
margin: 0;
padding: 0;
}

.app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
}

.main-container {
flex: 1 0 auto;
margin-top: 70px; //To account for height of Navbar, which uses fixed positioning
}

.font-header {
font-family: $font-header;
}

.text-bold {
font-weight: bold;
}

.text-25x {
font-size: 2.5em !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function CommitteeEventCard(props) {
? <img src={props.image.src} alt={props.image.alt} />
: <img src={`/images/committees/${props.committee}/${props.committee}_motif_base.png`} alt={props.image.alt} />
}
<h2>{props.title}</h2>
<h4 className="font-header text-bold">{props.title}</h4>
{props.desc}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
flex-direction: column;
margin: 0 1% 2rem;
text-align: left;

img {
height: 160px;
object-fit: cover;
}

h2 {
h4 {
font-size: 1.4em;
margin: 20px 10px 20px 0;
}

Expand Down
44 changes: 37 additions & 7 deletions src/components/Committees/CommitteeSections/CommitteeSection.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
import React from 'react';
import Body from './CommitteeSectionBody/CommitteeSectionBody';
import Header from './CommitteeSectionHeader/CommitteeSectionHeader';
import CommitteeEventCard from './CommitteeEventCard/CommitteeEventCard';
import Intro from './CommitteeSectionIntro/CommitteeSectionIntro';

function CommitteeSection(props) {
function CommitteeProjects({committee}) {
return (
<div id={props.committee.class} className='committee-section'>
<Header committee={props.committee}/>
<Intro committee={props.committee}/>
<Body committee={props.committee}/>
<div className="body-wrapper">
<h3 className="font-header text-bold text-25x">Events and Projects</h3>
<div className="card-container">
{committee.infoCards.map((card) => {
// TODO: destructure class after renaming it
const { image, title, desc } = card;
return (
<CommitteeEventCard
committee={committee.class}
image={image}
title={title}
desc={desc}
key={title}
/>
);
})}
</div>
</div>
);
}

function CommitteeSection(props) {
const { committee } = props;
// TODO: destructure committee after renaming the .class property
return (
<div id={committee.class} className="committee-section">
{/* Header image */}
{/* TODO: this could probably be a bit more accessible */}
<div className={`committee-header ${committee.class}`}>
<img src={committee.image} alt="committee logo" />
</div>
{/* Committee Intro */}
<Intro committee={committee} />
{/* Committee Body: events & projects */}
<CommitteeProjects committee={committee} />
</div>
);
}

export default CommitteeSection;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function CommitteeIconLink({committee, link}) {
);
}

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

// TODO: props destructuring
function CommitteeSectionIntro(props) {
return (
<div className="intro-row">
<div className="show-mobile">
{/* TODO: this should have an alt tag */}
<img src={props.committee.introImage} alt=""/>
<p>{props.committee.introImageDesc}</p>
</div>
Expand All @@ -62,6 +65,7 @@ function CommitteeSectionIntro(props) {
)}
</div>
</div>
{/* TODO: we can easily refactor this with the above .show-mobile to reduce code dupe */}
<div className="right-col">
<img src={props.committee.introImage} alt=""/>
<p>{props.committee.introImageDesc}</p>
Expand Down
13 changes: 0 additions & 13 deletions src/components/Committees/CommitteeSections/CommitteeSections.js

This file was deleted.

32 changes: 24 additions & 8 deletions src/components/Committees/Committees.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import React from 'react';
import Config from '../../config';
import Banner from '../Banner/Banner';
import CommitteeBanner from './CommitteesBanner/CommitteesBanner';
import CommitteeSections from './CommitteeSections/CommitteeSections';
import Navigation from './SidebarItem/SidebarItem';
import CommitteeSection from './CommitteeSections/CommitteeSection';
import Navigation from './Sidebar/Sidebar';

function Sponsors() {
function CommitteesBanner() {
return (
<div className="committee-banner-container">
<div className="banner-main-content">
<img src={process.env.PUBLIC_URL + '/images/acm_committees.png'} alt="the logos of all ACM committees" />
<div className="info">
<h1>Committees</h1>
<p className="half-size">ACM comprises eight committees, each serving a unique topic and mission. All of our events are open to everyone. We strive to cover all of our members’ interests and encourage members to explore new topics and events, too!</p>
</div>
</div>
</div>
);
}

function CommitteesPage() {
const committees = Config.committees;
return (
<div>
<Banner decorative />
<Navigation committees={Config.committees} />
<Navigation committees={committees} />
<div className="page-content">
<CommitteeBanner />
<CommitteeSections committees={Config.committees}/>
<CommitteesBanner />
<div className='committee-sections-container'>
{committees.map(committee => <CommitteeSection key={committee.name} committee={committee} />) }
</div>
</div>
</div>
);
}

export default Sponsors;
export default CommitteesPage;
17 changes: 0 additions & 17 deletions src/components/Committees/CommitteesBanner/CommitteesBanner.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/Committees/CommitteesBanner/style.scss

This file was deleted.

0 comments on commit a510659

Please sign in to comment.