-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(login): login page and progress on login form
- Loading branch information
1 parent
7e350d4
commit 53729e2
Showing
16 changed files
with
270 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* @file LoginForm.js | ||
* Exports a component that allows users to log into EditVR. | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { TextField, Button, withStyles } from '@material-ui/core'; | ||
|
||
import LoginFormStyles from './LoginForm.style'; | ||
|
||
class LoginForm extends Component { | ||
static propTypes = { | ||
classes: PropTypes.shape({ | ||
textField: PropTypes.string.isRequired, | ||
button: PropTypes.string.isRequired | ||
}).isRequired | ||
}; | ||
|
||
state = { | ||
username: null, | ||
password: null, | ||
apiLoading: false, | ||
apiMessage: null | ||
}; | ||
|
||
/** | ||
* Handles field update action. | ||
* | ||
* @param {object} event - Field update event. | ||
*/ | ||
handleFieldUpdate = event => { | ||
const state = {}; | ||
state[event.target.id] = event.target.value; | ||
this.setState(state); | ||
}; | ||
|
||
/** | ||
* Handles a login form submit action. | ||
* | ||
* @param {object} event - Submit event object. | ||
*/ | ||
handleSubmit = event => {}; | ||
|
||
/** | ||
* {@inheretdoc} | ||
*/ | ||
render() { | ||
const { classes } = this.props; | ||
const { apiLoading, apiMessage } = this.state; | ||
|
||
return ( | ||
<form onSubmit={this.handleSubmit}> | ||
<TextField | ||
id="username" | ||
label="Username" | ||
type="text" | ||
required | ||
onChange={this.handleFieldUpdate} | ||
className={classes.textField} | ||
/> | ||
<TextField | ||
id="password" | ||
label="Password" | ||
type="password" | ||
required | ||
onChange={this.handleFieldUpdate} | ||
className={classes.textField} | ||
/> | ||
<Button | ||
variant="raised" | ||
color="primary" | ||
type="submit" | ||
className={classes.button} | ||
> | ||
Log In | ||
</Button> | ||
</form> | ||
); | ||
} | ||
} | ||
|
||
export default withStyles(LoginFormStyles)(LoginForm); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @file LoginForm.style.js | ||
* Exports LoginForm component styles. | ||
*/ | ||
|
||
export default theme => ({ | ||
textField: { | ||
width: '100%', | ||
marginTop: `${theme.spacing.unit * 2}px` | ||
}, | ||
button: { | ||
marginTop: `${theme.spacing.unit * 3}px`, | ||
marginRight: theme.spacing.unit | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @file index.js | ||
* Exports all components. | ||
*/ | ||
|
||
import LoginForm from './LoginForm/LoginForm'; | ||
|
||
export { LoginForm }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/layouts/HomeLayout.test.js → src/layouts/ThinLayout.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<ThinLayout /> Matches its snapshot 1`] = ` | ||
<div | ||
className="ThinLayout-wrapper-1" | ||
id="layout__wrapper" | ||
> | ||
<div | ||
className={undefined} | ||
id="layout__thin-wrapper" | ||
> | ||
<header | ||
className="Header-wrapper-3" | ||
> | ||
<img | ||
alt="EditVR logo" | ||
className="Header-logo-4" | ||
src="editvr-logo.svg" | ||
/> | ||
</header> | ||
<div> | ||
child | ||
</div> | ||
<footer | ||
className="Footer-wrapper-5" | ||
> | ||
<div | ||
className="Footer-elements-6" | ||
> | ||
<a | ||
href="https://fourkitchens.com" | ||
> | ||
<p | ||
className="MuiTypography-root-9 MuiTypography-body1-18 Footer-text-8" | ||
type="body1" | ||
> | ||
EditVR is a product of | ||
</p> | ||
<img | ||
alt="Four Kitchens" | ||
className="Footer-logo-7" | ||
src="4k-logo-reversed.svg" | ||
/> | ||
</a> | ||
</div> | ||
</footer> | ||
</div> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file Home.js | ||
* Exports a React component that renders EditVR's home page. | ||
*/ | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Typography, Button, withStyles } from '@material-ui/core'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
import { ThinLayout } from '../../layouts'; | ||
import HomeStyles from './Home.style'; | ||
|
||
const Home = ({ classes }) => ( | ||
<ThinLayout> | ||
<Typography type="body1"> | ||
<b>EditVR is a free, open-source WebVR editor</b> that lets you produce | ||
interactive and affordable 360 tours and VR stories. EditVR makes | ||
immersive experiences available to everyone using devices they already | ||
own. Nothing to buy, download, or install! | ||
</Typography> | ||
|
||
<NavLink to="/login"> | ||
<Button className={classes.button} variant="raised" color="primary"> | ||
Login | ||
</Button> | ||
</NavLink> | ||
<NavLink to="/register"> | ||
<Button className={classes.button} variant="raised" color="primary"> | ||
Register | ||
</Button> | ||
</NavLink> | ||
</ThinLayout> | ||
); | ||
|
||
Home.propTypes = { | ||
classes: PropTypes.shape({ | ||
button: PropTypes.string.isRequired | ||
}).isRequired | ||
}; | ||
|
||
export default withStyles(HomeStyles)(Home); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @file Home.style.js | ||
* Exports Home component styles. | ||
*/ | ||
|
||
export default theme => ({ | ||
button: { | ||
marginTop: `${theme.spacing.unit * 3}px`, | ||
marginRight: theme.spacing.unit | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file Login.js | ||
* Exports a React component that renders EditVR's login. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Typography } from '@material-ui/core'; | ||
|
||
import { LoginForm } from '../../components'; | ||
import { ThinLayout } from '../../layouts'; | ||
|
||
const Login = () => ( | ||
<ThinLayout> | ||
<Typography variant="headline">Log into EditVR</Typography> | ||
<LoginForm /> | ||
</ThinLayout> | ||
); | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.