mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Webatrice: Account Registration form (pt2) (#4454)
Co-authored-by: ParkTandem <93353951+ParkTandem@users.noreply.github.com>
This commit is contained in:
parent
ac300b0b6d
commit
a87c66885c
5 changed files with 128 additions and 68 deletions
|
|
@ -1,55 +1,66 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm } from 'redux-form'
|
||||
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
||||
import './RegisterForm.css';
|
||||
|
||||
const RegisterForm = ({ handleSubmit }) => (
|
||||
<Form className="registerForm" onSubmit={handleSubmit} autoComplete="off">
|
||||
<div className="registerForm-item">
|
||||
<Field label="Host" name="host" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Port" name="port" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Player Name" name="user" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Password" name="pass" type="password" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Password (again)" name="passwordConfirm" type="password" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Email" name="email" type="email" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Email (again)" name="emailConfirm" type="email" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Real Name" name="realName" component={InputField} />
|
||||
</div>
|
||||
<Button className="registerForm-submit" color="primary" variant="contained" type="submit">
|
||||
Register
|
||||
</Button>
|
||||
</Form>
|
||||
);
|
||||
|
||||
const propsMap = {
|
||||
form: FormKey.REGISTER,
|
||||
};
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
initialValues: {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(reduxForm(propsMap)(RegisterForm));
|
||||
// eslint-disable-next-line
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm, change } from 'redux-form'
|
||||
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField, KnownHosts } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
||||
import './RegisterForm.css';
|
||||
|
||||
const RegisterForm = (props) => {
|
||||
const { dispatch, handleSubmit } = props;
|
||||
|
||||
const onHostChange = ({ host, port }) => {
|
||||
dispatch(change(FormKey.REGISTER, 'host', host));
|
||||
dispatch(change(FormKey.REGISTER, 'port', port));
|
||||
}
|
||||
return (
|
||||
<Form className="registerForm row" onSubmit={handleSubmit} autoComplete="off">
|
||||
<div className="leftRegisterForm column" >
|
||||
<div className="registerForm-item">
|
||||
<KnownHosts onChange={onHostChange} />
|
||||
{ /* Padding is off */ }
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Country" name="country" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Real Name" name="realName" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Email" name="email" type="email" component={InputField} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="rightRegisterForm column">
|
||||
<div className="registerForm-item">
|
||||
<Field label="Player Name" name="user" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Password" name="pass" type="password" component={InputField} />
|
||||
</div>
|
||||
<div className="registerForm-item">
|
||||
<Field label="Password (again)" name="passwordConfirm" type="password" component={InputField} />
|
||||
</div>
|
||||
<Button className="registerForm-submit tall" color="primary" variant="contained" type="submit">
|
||||
Register
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
</Form >
|
||||
);
|
||||
}
|
||||
|
||||
const propsMap = {
|
||||
form: FormKey.REGISTER,
|
||||
};
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
initialValues: {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(reduxForm(propsMap)(RegisterForm));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue