From 2b5ce92f746ba8fb35ba2cc0d78a8b9a42960e84 Mon Sep 17 00:00:00 2001 From: haraldox Date: Tue, 30 Jan 2018 15:22:12 +0100 Subject: [WIP] started work on infobox --- src/components/auth/Invite.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/components/auth/Invite.js') diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js index 9c32220f8..2776af05f 100644 --- a/src/components/auth/Invite.js +++ b/src/components/auth/Invite.js @@ -5,6 +5,8 @@ import { defineMessages, intlShape } from 'react-intl'; import { Link } from 'react-router'; import classnames from 'classnames'; +import Infobox from '../ui/Infobox'; +import Appear from '../ui/effects/Appear'; import Form from '../../lib/Form'; import { email } from '../../helpers/validation-helpers'; import Input from '../ui/Input'; @@ -70,9 +72,17 @@ export default class Invite extends Component { submit(e) { e.preventDefault(); + + const from = this.props.from; + this.form.submit({ onSuccess: (form) => { - this.props.onSubmit({ invites: form.values().invite }); + this.props.onSubmit({ + invites: form.values().invite, + from + }); + this.form.clear() + this.form.$('invite').$('0').focus() }, onError: () => {}, }); @@ -81,7 +91,7 @@ export default class Invite extends Component { render() { const { form } = this; const { intl } = this.context; - const { from, embed } = this.props; + const { from, embed, success } = this.props; const atLeastOneEmailAddress = form.$('invite') .map(invite => invite.$('email').value) @@ -92,7 +102,20 @@ export default class Invite extends Component { 'invite__embed--button': embed, }); + console.log(success) + return ( +
+ {(success && + + Great Success! + + )} +
this.submit(e)}> {!embed && ()}
+
); } } -- cgit v1.2.3-70-g09d2