diff --git a/src/common/containers/Login/components/index.jsx b/src/common/containers/Login/components/index.jsx new file mode 100644 index 00000000..92dd9b58 --- /dev/null +++ b/src/common/containers/Login/components/index.jsx @@ -0,0 +1,93 @@ +// @flow +import React, {Component} from 'react' +import {Form, Message, Grid, Button} from 'semantic-ui-react' +import {Helmet} from 'react-helmet' +import _ from 'lodash' + +type Props = { + login: (data: Object) => void, + errors: Object +} + +type State = { + username: string, + password: string +} + +class LoginComponent extends Component { + props: Props + state: State = { + username: '', + password: '' + } + + handleSubmit = (e: Event) => { + e.preventDefault() + const {username, password} = this.state + this.props.login({username, password}) + } + + handleChange = (e: Event, {name, value}: {name: string, value: string}) => { + this.setState({ + [name]: value + }) + } + + render () { + const {username, password} = this.state + // Error from server + const {errors} = this.props + const loginFormProps = {error: !_.isEmpty(errors)} + + return ( + + + Suicrux:Login + + + + {/* Consider using Redux-Form */} +
+ {errors && ( + + )} + + +
+
+ +
+
+
+ ) + } +} + +export default LoginComponent