Skip to content

Commit d603b59

Browse files
committed
Added more sttyles to the sign up form
1 parent 413b15f commit d603b59

File tree

8 files changed

+105
-23
lines changed

8 files changed

+105
-23
lines changed

src/assets/images/logo-squared.png

64.7 KB
Loading

src/components/fields/BasicInput.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/** @jsx jsx */
2+
import { jsx } from '@emotion/core';
3+
import { Component } from 'react';
4+
import { PropTypes } from 'prop-types';
5+
6+
class TextField extends Component {
7+
static propTypes = {
8+
label: PropTypes.string,
9+
meta: PropTypes.object.isRequired,
10+
input: PropTypes.object.isRequired,
11+
placeholder: PropTypes.string,
12+
type: PropTypes.string,
13+
}
14+
15+
static defaultProps = {
16+
type: 'text',
17+
}
18+
19+
render() {
20+
const { label, meta, input, placeholder } = this.props;
21+
22+
const inputStyle = {
23+
display: 'inline-block',
24+
height: 40,
25+
padding: '0 10px',
26+
fontSize: 16,
27+
lineHeight: 25,
28+
color: '#73879C',
29+
resize: 'none',
30+
verticalAlign: 'middle',
31+
boxShadow: 'none',
32+
backgroundColor: '#f5f5f5',
33+
border: '1px solid #E6E9ED',
34+
borderRadius: 2,
35+
transition: 'all 200ms',
36+
marginBottom: 1,
37+
};
38+
39+
return(
40+
<div css={{ display: 'block', margin: '10px 0' }}>
41+
{label && <label htmlFor={ input.name }>
42+
<i className={ meta.error ? 'tint-color icon-asterisk' : 'icon-ok green' } />
43+
&nbsp;{ label }:
44+
</label>}
45+
<input type={ this.props.type }
46+
css={ inputStyle }
47+
onBlur={ input.onBlur }
48+
onChange={ input.onChange }
49+
placeholder={ placeholder }
50+
value={ input.value }
51+
/>
52+
<p css={{ }}>
53+
{meta.error && meta.touched && meta.error}
54+
</p>
55+
</div>
56+
);
57+
}
58+
}
59+
60+
export default TextField;

src/components/fields/Text.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import React, { Component } from 'react';
1+
/** @jsx jsx */
2+
import { jsx } from '@emotion/core';
3+
import { Component } from 'react';
24
import { PropTypes } from 'prop-types';
35

46
class TextField extends Component {

src/components/fields/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import TextField from './Text';
2+
import BasicInput from './BasicInput';
23

34
export {
45
TextField,
6+
BasicInput,
57
};

src/components/join/form.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/** @jsx jsx */
2+
import { jsx } from '@emotion/core';
23
import React from 'react';
34
import StyledLink from 'Lib/buttons/Link';
45
import blueBg from 'Images/blue-bg.jpg';
5-
import femaleOctocat from 'Images/femalecodertocat.png';
6+
import logoSquared from 'Images/logo-squared.png';
67
import { BACKEND_URL } from 'Constants';
7-
import { jsx } from '@emotion/core';
88
import { Link } from 'react-router-dom';
99
import { Field } from 'redux-form';
10-
import { TextField } from 'Components/fields/';
10+
import { BasicInput } from 'Components/fields/';
1111

1212
class JoinForm extends React.Component {
1313
render() {
@@ -16,13 +16,13 @@ class JoinForm extends React.Component {
1616
<div className="container inner-top-md inner-bottom-sm">
1717
<div className="row">
1818
<div className="col-md-6 inner-right inner-bottom-xs">
19-
<header>
19+
<header css={{ p: { fontSize: 16 }}}>
2020
<form css={{ background: 'white', borderRadius: '8px', padding: '18px', margin: '0 10px' }}>
2121
<h1>Create an account</h1>
2222
<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"/>
23+
<Field name="username" component={ BasicInput } type="text" required placeholder="Username" />
24+
<Field name="email" component={ BasicInput } type="email" required placeholder="Email"/>
25+
<Field name="password" component={ BasicInput } type="password" required placeholder="Password"/>
2626
<p>
2727
<StyledLink to={`${BACKEND_URL}/api/auth/github`} css={{ fontSize: '18px', padding: '15px 35px 17px' }}>
2828
Submit
@@ -37,13 +37,8 @@ class JoinForm extends React.Component {
3737
</header>
3838
</div>
3939
<div className="col-md-6">
40-
<div>
41-
<img src={femaleOctocat} alt="Female coder octocat by jeejkang" />
42-
<p className="text-center">
43-
<a href="https://octodex.github.com/femalecodertocat" target="_blank">
44-
Female coder octocat
45-
</a>
46-
</p>
40+
<div css={{ margin: '10x 20px', textAlign: 'center', }}>
41+
<img src={logoSquared} alt="codecorgi logo" ariaIgnore />
4742
</div>
4843
</div>
4944
</div>

src/containers/join/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import femaleOctocat from '../../assets/images/femalecodertocat.png';
2+
import logoSquared from 'Images/logo-squared.png';
33
import { PROD_URL } from '../../constants';
44
import { Helmet } from 'react-helmet';
55
import { readEndpoint } from 'redux-json-api';
@@ -30,12 +30,11 @@ class SignupContainer extends React.Component {
3030
<JoinForm />
3131
<Helmet>
3232
<title>Signup for codecorgi and build your dev profile</title>
33-
<meta property="og:type" content="business.business" />
3433
<meta property="og:title" content="Signup for codecorgi and build your dev profile" />
3534
<meta property="og:url" content={ `${PROD_URL}/join` } />
36-
<meta property="og:image" content={`${femaleOctocat}` } />
35+
<meta property="og:image" content={`${ logoSquared }` } />
3736
<meta name="twitter:title" content="Signup for codecorgi and build your dev profile" />
38-
<meta name="twitter:image" content={`${femaleOctocat}` } />
37+
<meta name="twitter:image" content={`${ logoSquared }` } />
3938
</Helmet>
4039
</React.Fragment>
4140
);
@@ -54,7 +53,6 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
5453
}, dispatch);
5554

5655
export default connect(mapStateToProps, mapDispatchToProps)(reduxForm({
57-
form: 'bid',
58-
enableReinitialize: true,
59-
keepDirtyOnReinitialize: true,
56+
form: 'join',
57+
enableReinitialize: false,
6058
})(SignupContainer));

src/modules/account.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { writeEndpoint } from 'redux-json-api';
2+
3+
export const USER_CREATED = 'USER_CREATED';
4+
5+
export function signedUp(profile, authenticated = true) {
6+
return {
7+
type: USER_CREATED,
8+
attributes: {
9+
authenticated,
10+
id: `${profile.id}`,
11+
...profile,
12+
}
13+
};
14+
}
15+
16+
export function signUp(data) {
17+
return (dispatch) => {
18+
dispatch(writeEndpoint('/accounts')).then(response => {
19+
if (_get(response, 'body.data[0].attributes', undefined)) {
20+
dispatch(signedUp(response.body.data[0].attributes, true));
21+
}
22+
});
23+
};
24+
}

src/modules/profile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import _merge from 'lodash/merge';
22
import _get from 'lodash/get';
3-
export const PROFILE_RECEIVED = 'PROFILE_RECEIVED';
43
import { readEndpoint } from 'redux-json-api';
54

5+
export const PROFILE_RECEIVED = 'PROFILE_RECEIVED';
6+
67
export function receiveProfile(profile, authenticated = true) {
78
return {
89
type: PROFILE_RECEIVED,

0 commit comments

Comments
 (0)