Skip to content

Commit

Permalink
Merge pull request #47 from alecortega/community-on-today
Browse files Browse the repository at this point in the history
is community today initial page
  • Loading branch information
muigaiunaka authored Jun 13, 2019
2 parents d0d54f9 + 57cae76 commit 20c648f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/Community/IsCommunityOnToday/IsCommunityOnToday.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.bg-4 {
background: #c51017;
}
59 changes: 59 additions & 0 deletions src/pages/Community/IsCommunityOnToday/IsCommunityOnToday.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import styles from './IsCommunityOnToday.css';
import CSSModules from 'react-css-modules';
import RouteTransition from '../../../components/RouteTransition/RouteTransition';
import Helmet from 'react-helmet';

import UILayout from 'UILibrary/layout/UILayout';
import UISection from 'UILibrary/layout/UISection';
import UIFlexRow from 'UILibrary/grid/UIFlexRow';

class IsCommunityOnToday extends React.PureComponent {
constructor(props) {
super(props);

this.state = {
today: new Date().toISOString().slice(0, 10),
};
}
componentDidMount() {
this.logMessage();
}
logMessage = () => {
let message = `Resilient Coders community is every Tuesday and Thursday, from 3:30pm to 6:00pm. If it is cancelled, you'll see it here`;
let messageStyles = `background: #21262D; color: #FFF; font-size: medium; padding: 4px;`;
console.log(`%c${message}`, `${messageStyles}`);
}
render() {
const { today } = this.state;
const cancelledCommunityDates = new Set([
// YYYY-MM-DD
"2019-06-11","2019-08-01","2019-08-15","2019-08-22",
"2019-11-14","2019-12-12",
// reference the dates in RC_bootcamp_calendar_2019
]);
const isTuesOrThurs = () => {
let today = new Date();
// check if Tuesday (2) or Thursday (4)
return (today.getDay() === 2 || today.getDay() === 4);
}
return (
<RouteTransition>
<Helmet title="Is Community Today?" />
<UILayout styleName="bg-4">
<UISection>
<UIFlexRow justify="center" className="p-top-24 p-bottom-24 text-center">
{
isTuesOrThurs(today) && !cancelledCommunityDates.has(today) ?
<h1>Yes</h1> :
<h1>No</h1>
}
</UIFlexRow>
</UISection>
</UILayout>
</RouteTransition>
)
}
}

export default CSSModules(IsCommunityOnToday, styles);
2 changes: 2 additions & 0 deletions src/routeConfig/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import RosterMember from '../pages/Bootcamp/Roster/RosterMember/RosterMember';
import rosterMembersConfig from '../pages/Bootcamp/Roster/rosterMembersConfig';

import Playbook from '../pages/Playbook/Playbook';
import IsCommunityOnToday from '../pages/Community/IsCommunityOnToday/IsCommunityOnToday';

import {Route, IndexRoute, Redirect} from 'react-router';
import App from '../App';
Expand All @@ -43,6 +44,7 @@ export default(
<Route path="team" component={Team}/>
<Route path="news" component={News}/>
<Route path="diversityplaybook" component={Playbook}/>
<Route path="is-community-today" component={IsCommunityOnToday} />
<Route path="get-involved">
<IndexRoute component={GetInvolvedPage} />
<Route path="company" component={GetInvolvedCompany}/>
Expand Down

0 comments on commit 20c648f

Please sign in to comment.