Добавлено автоматическое установление E-mail адреса пользователя в форму обратной связи

This commit is contained in:
ErickSkrauch 2016-06-16 10:42:56 +03:00
parent 56d88100da
commit e543fae4ec

View File

@ -20,17 +20,20 @@ const CONTACT_CATEGORIES = [
<Message {...messages.other} /> <Message {...messages.other} />
]; ];
export default class ContactForm extends Component { class ContactForm extends Component {
static displayName = 'ContactForm'; static displayName = 'ContactForm';
static propTypes = { static propTypes = {
onClose: PropTypes.func.isRequired onClose: PropTypes.func.isRequired,
user: PropTypes.shape({
email: PropTypes.string
}).isRequired
}; };
form = new FormModel(); form = new FormModel();
render() { render() {
const {onClose} = this.props; const {onClose, user} = this.props;
const {form} = this; const {form} = this;
return ( return (
@ -69,6 +72,7 @@ export default class ContactForm extends Component {
label={messages.email} label={messages.email}
type="email" type="email"
skin="light" skin="light"
defaultValue={user.email}
/> />
</div> </div>
</div> </div>
@ -106,3 +110,9 @@ export default class ContactForm extends Component {
; ;
}; };
} }
import { connect } from 'react-redux';
export default connect((state) => ({
user: state.user
}))(ContactForm);