-
Notifications
You must be signed in to change notification settings - Fork 80
/
Form.jsx
61 lines (56 loc) · 1.49 KB
/
Form.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { Accounts } from 'meteor/accounts-base';
import './Fields.jsx';
import './Buttons.jsx';
import './FormMessage.jsx';
import './PasswordOrService.jsx';
import './SocialButtons.jsx';
import './FormMessages.jsx';
export class Form extends React.Component {
componentDidMount() {
let form = this.form;
if (form) {
form.addEventListener('submit', (e) => {
e.preventDefault();
});
}
}
render() {
const {
hasPasswordService,
oauthServices,
fields,
buttons,
error,
messages,
translate,
ready = true,
className
} = this.props;
return (
<form
ref={(ref) => this.form = ref}
className={[className, ready ? "ready" : null].join(' ')}
className="accounts-ui"
noValidate
>
<Accounts.ui.Fields fields={ fields } />
<Accounts.ui.Buttons buttons={ buttons } />
<Accounts.ui.PasswordOrService oauthServices={ oauthServices } translate={ translate } />
<Accounts.ui.SocialButtons oauthServices={ oauthServices } />
<Accounts.ui.FormMessages messages={messages} />
</form>
);
}
}
Form.propTypes = {
oauthServices: PropTypes.object,
fields: PropTypes.object.isRequired,
buttons: PropTypes.object.isRequired,
translate: PropTypes.func.isRequired,
error: PropTypes.string,
ready: PropTypes.bool
};
Accounts.ui.Form = Form;