Skip to content

Commit 3c4bd73

Browse files
committed
drafted sign up form
1 parent fdc5d8a commit 3c4bd73

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

src/components/fields/Text.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,31 @@ class TextField extends Component {
77
meta: PropTypes.object.isRequired,
88
input: PropTypes.object.isRequired,
99
placeholder: PropTypes.string,
10+
type: PropTypes.string,
11+
}
12+
13+
static defaultProps = {
14+
type: 'text',
1015
}
1116

1217
render() {
1318
const { label, meta, input, placeholder } = this.props;
1419
return(
1520
<div className={ 'form-group ' + (meta.error && meta.touched && 'has-error')}>
16-
<label htmlFor={ input.name }>
21+
{label && <label htmlFor={ input.name }>
1722
<i className={ meta.error ? 'tint-color icon-asterisk' : 'icon-ok green' } />
1823
&nbsp;{ label }:
19-
</label>
20-
<input type="text"
24+
</label>}
25+
<input type={ this.props.type }
2126
className="form-control"
2227
onBlur={ input.onBlur }
2328
onChange={ input.onChange }
2429
placeholder={ placeholder }
2530
value={ input.value }
2631
/>
27-
{/* <span className="help-block">
28-
{meta.error && meta.touched && <span>{meta.error}</span>}&nbsp;
29-
</span> */}
32+
<p className="help-block">
33+
{meta.error && meta.touched && meta.error}
34+
</p>
3035
</div>
3136
);
3237
}

src/components/fields/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import TextField from './Text';
2+
3+
export {
4+
TextField,
5+
};

src/components/join/form.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,37 @@ import femaleOctocat from 'Images/femalecodertocat.png';
66
import { BACKEND_URL } from 'Constants';
77
import { jsx } from '@emotion/core';
88
import { Link } from 'react-router-dom';
9+
import { Field } from 'redux-form';
10+
import { TextField } from 'Components/fields/';
911

1012
class JoinForm extends React.Component {
1113
render() {
1214
return (
1315
<section css={{ backgroundImage: `url(${blueBg})` }}>
1416
<div className="container inner-top-md inner-bottom-sm">
1517
<div className="row">
16-
<div className="col-md-5 inner-right inner-bottom-xs">
18+
<div className="col-md-6 inner-right inner-bottom-xs">
1719
<header>
18-
<h1>Join</h1>
19-
<p>You'll use your email to log in, your username is used when displaying submissions and comments.</p>
20-
<p>
21-
<StyledLink to={`${BACKEND_URL}/api/auth/github`} css={{ fontSize: '18px', padding: '15px 35px 17px', marginTop: '35px' }}>
22-
Submit
23-
</StyledLink>
24-
</p>
25-
<p> Have an account?
26-
<Link to={`${BACKEND_URL}/api/auth/github`}>
27-
Log in
28-
</Link>
29-
</p>
30-
<p>
31-
<Link to={`${BACKEND_URL}/api/auth/github`}>
32-
Forgot Password?
33-
</Link>
34-
</p>
20+
<form css={{ background: 'white', borderRadius: '8px', padding: '18px', margin: '0 10px' }}>
21+
<h1>Create an account</h1>
22+
<p>You'll use your email to log in, your username is used when displaying submissions and comments.</p>
23+
<Field name="username" component={ TextField } type="text" required placeholder="Username"/>
24+
<Field name="email" component={ TextField } type="email" required placeholder="Email"/>
25+
<Field name="password" component={ TextField } type="password" required placeholder="Password"/>
26+
<p>
27+
<StyledLink to={`${BACKEND_URL}/api/auth/github`} css={{ fontSize: '18px', padding: '15px 35px 17px' }}>
28+
Submit
29+
</StyledLink>
30+
</p>
31+
<p> Have an account?&nbsp;
32+
<Link to={`${BACKEND_URL}/api/auth/github`}>
33+
Log in
34+
</Link>
35+
</p>
36+
</form>
3537
</header>
3638
</div>
37-
<div className="col-md-7">
39+
<div className="col-md-6">
3840
<div>
3941
<img src={femaleOctocat} alt="Female coder octocat by jeejkang" />
4042
<p className="text-center">

0 commit comments

Comments
 (0)