accounts-ui/imports/ui/components/Form.jsx

51 lines
1.3 KiB
React
Raw Normal View History

2016-03-28 22:34:50 +02:00
import React from 'react';
import ReactDOM from 'react-dom';
2016-03-28 22:34:50 +02:00
import {Accounts} from 'meteor/accounts-base';
import './Fields.jsx';
import './Buttons.jsx';
import './FormMessage.jsx';
import './PasswordOrService.jsx';
import './SocialButtons.jsx';
2016-03-28 22:34:50 +02:00
export class Form extends React.Component {
componentDidMount() {
let form = this.form;
if (form) {
form.addEventListener('submit', (e) => {
2016-04-02 21:02:28 +02:00
e.preventDefault();
});
}
}
2016-03-28 22:34:50 +02:00
render() {
const {
hasPasswordService,
oauthServices,
fields,
buttons,
error,
message,
ready = true,
className
} = this.props;
2016-03-28 22:34:50 +02:00
return (
<form ref={(ref) => this.form = ref} className={[className, ready ? "ready" : null].join(' ')} className="accounts-ui">
2016-03-28 22:34:50 +02:00
<Accounts.ui.Fields fields={ fields } />
<Accounts.ui.Buttons buttons={ buttons } />
<Accounts.ui.PasswordOrService oauthServices={ oauthServices } />
<Accounts.ui.SocialButtons oauthServices={ oauthServices } />
<Accounts.ui.FormMessage {...message} />
2016-03-28 22:34:50 +02:00
</form>
);
}
}
Form.propTypes = {
2016-03-31 11:58:09 +02:00
oauthServices: React.PropTypes.object,
2016-03-28 22:34:50 +02:00
fields: React.PropTypes.object.isRequired,
buttons: React.PropTypes.object.isRequired,
error: React.PropTypes.string,
ready: React.PropTypes.bool
};
Accounts.ui.Form = Form;