Skip to content

Commit 73485b0

Browse files
committed
creating container and component for /join
1 parent 2329a69 commit 73485b0

File tree

4 files changed

+106
-4
lines changed

4 files changed

+106
-4
lines changed

src/components/header/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Header extends React.Component {
3434
}
3535

3636
render() {
37-
const { authenticated, username } = this.props.profile;
37+
const { authenticated } = this.props.profile;
3838

3939
return (<header className="header">
4040
<div className="navbar">
@@ -65,7 +65,7 @@ class Header extends React.Component {
6565
<Link to="/challenges">Challenges</Link>
6666
</li>
6767
<li>
68-
{!authenticated && <Link className="red-button" to="/signup" onClick={this.toggleVisibility}>Signup {username}</Link>}
68+
{!authenticated && <Link className="red-button" to="/join" onClick={this.toggleVisibility}>Join</Link>}
6969
{authenticated && <Link className="red-button" to="/profile" onClick={this.toggleVisibility}>Profile</Link>}
7070
</li>
7171
</ul>

src/components/join/form.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import Link from 'Lib/buttons/Link';
3+
import blueBg from 'Images/blue-bg.jpg';
4+
import femaleOctocat from 'Images/femalecodertocat.png';
5+
import { BACKEND_URL } from 'Constants';
6+
7+
class JoinForm extends React.Component {
8+
render() {
9+
return (
10+
<section id="hero" className="dark-bg img-bg img-bg-soft" style={{ backgroundImage: `url(${blueBg})` }}>
11+
<div className="container inner-top-md inner-bottom-sm">
12+
<div className="row">
13+
<div className="col-md-5 inner-right inner-bottom-xs">
14+
<header>
15+
<h1>Signup</h1>
16+
<p>Use github to create or access your account.</p>
17+
<p>
18+
<Link to={`${BACKEND_URL}/api/auth/github`} target="_self" css={{ fontSize: '18px', padding: '15px 35px 17px', marginTop: '35px' }}>
19+
<i className="icon-github" />
20+
Github Signup
21+
</Link>
22+
</p>
23+
</header>
24+
</div>
25+
<div className="col-md-7">
26+
<div>
27+
<img src={femaleOctocat} alt="Female coder octocat by jeejkang" />
28+
<p className="text-center">
29+
<a href="https://octodex.github.com/femalecodertocat" target="_blank">
30+
Female coder octocat
31+
</a>
32+
</p>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</section>
38+
);
39+
}
40+
}
41+
42+
export default JoinForm;

src/containers/join/index.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from 'react';
2+
import femaleOctocat from '../../assets/images/femalecodertocat.png';
3+
import { PROD_URL } from '../../constants';
4+
import { Helmet } from 'react-helmet';
5+
import { readEndpoint } from 'redux-json-api';
6+
import PropTypes from 'prop-types';
7+
import { bindActionCreators } from 'redux';
8+
import { connect } from 'react-redux';
9+
import ReactRouterPropTypes from 'react-router-prop-types';
10+
import { reduxForm } from 'redux-form';
11+
import JoinForm from 'Components/join/form';
12+
13+
14+
class SignupContainer extends React.Component {
15+
static propTypes = {
16+
readEndpoint: PropTypes.func.isRequired,
17+
authenticated: PropTypes.bool.isRequired,
18+
history: ReactRouterPropTypes.history.isRequired,
19+
}
20+
21+
componentWillReceiveProps() {
22+
if (this.props.authenticated) {
23+
this.props.history.push('/profile');
24+
}
25+
}
26+
27+
render() {
28+
return(
29+
<React.Fragment>
30+
<JoinForm />
31+
<Helmet>
32+
<title>Signup for codecorgi and build your dev profile</title>
33+
<meta property="og:type" content="business.business" />
34+
<meta property="og:title" content="Signup for codecorgi and build your dev profile" />
35+
<meta property="og:url" content={ `${PROD_URL}/join` } />
36+
<meta property="og:image" content={`${femaleOctocat}` } />
37+
<meta name="twitter:title" content="Signup for codecorgi and build your dev profile" />
38+
<meta name="twitter:image" content={`${femaleOctocat}` } />
39+
</Helmet>
40+
</React.Fragment>
41+
);
42+
}
43+
}
44+
45+
const mapStateToProps = (state) => {
46+
const { profile } = state;
47+
return {
48+
authenticated: profile.authenticated || false,
49+
};
50+
};
51+
52+
const mapDispatchToProps = (dispatch) => bindActionCreators({
53+
readEndpoint,
54+
}, dispatch);
55+
56+
export default connect(mapStateToProps, mapDispatchToProps)(reduxForm({
57+
form: 'bid',
58+
enableReinitialize: true,
59+
keepDirtyOnReinitialize: true,
60+
})(SignupContainer));

src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import WeAreOpenSource from './containers/about/openSource';
77
import Profile from './containers/profile';
88
import e404 from './containers/404';
99
import ProfileEdit from './containers/profile/Edit';
10-
import Signup from './containers/signup';
10+
import Join from './containers/join';
1111
import SubmitFormContainer from './containers/submit/form';
1212
import SubmitEditContainer from './containers/submit/edit';
1313
import SubmitViewContainer from './containers/submit';
@@ -23,7 +23,7 @@ class Routes extends React.Component {
2323
<Route exact path="/" component={Home} />
2424
<Route exact path="/about/open-source" component={WeAreOpenSource} />
2525
<Route exact path="/about" component={About} />
26-
<Route exact path="/signup" component={Signup} />
26+
<Route exact path="/join" component={Join} />
2727
<Route exact path="/learning" component={LearningPageContainer} />
2828
<Route exact path="/challenges" component={ChallengesContainer} />
2929
<Route exact path="/418" component={() => <EasterEgg type="418" />} />

0 commit comments

Comments
 (0)