diff options
author | 2018-01-30 15:22:12 +0100 | |
---|---|---|
committer | 2018-01-30 15:22:12 +0100 | |
commit | 2b5ce92f746ba8fb35ba2cc0d78a8b9a42960e84 (patch) | |
tree | 6b5064d12dc973919b74a25a63bccb182647384f /src/components/auth/Invite.js | |
parent | [MINOR] fix indentation (diff) | |
download | ferdium-app-2b5ce92f746ba8fb35ba2cc0d78a8b9a42960e84.tar.gz ferdium-app-2b5ce92f746ba8fb35ba2cc0d78a8b9a42960e84.tar.zst ferdium-app-2b5ce92f746ba8fb35ba2cc0d78a8b9a42960e84.zip |
[WIP] started work on infobox
Diffstat (limited to 'src/components/auth/Invite.js')
-rw-r--r-- | src/components/auth/Invite.js | 28 |
1 files changed, 26 insertions, 2 deletions
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'; | |||
5 | import { Link } from 'react-router'; | 5 | import { Link } from 'react-router'; |
6 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
7 | 7 | ||
8 | import Infobox from '../ui/Infobox'; | ||
9 | import Appear from '../ui/effects/Appear'; | ||
8 | import Form from '../../lib/Form'; | 10 | import Form from '../../lib/Form'; |
9 | import { email } from '../../helpers/validation-helpers'; | 11 | import { email } from '../../helpers/validation-helpers'; |
10 | import Input from '../ui/Input'; | 12 | import Input from '../ui/Input'; |
@@ -70,9 +72,17 @@ export default class Invite extends Component { | |||
70 | 72 | ||
71 | submit(e) { | 73 | submit(e) { |
72 | e.preventDefault(); | 74 | e.preventDefault(); |
75 | |||
76 | const from = this.props.from; | ||
77 | |||
73 | this.form.submit({ | 78 | this.form.submit({ |
74 | onSuccess: (form) => { | 79 | onSuccess: (form) => { |
75 | this.props.onSubmit({ invites: form.values().invite }); | 80 | this.props.onSubmit({ |
81 | invites: form.values().invite, | ||
82 | from | ||
83 | }); | ||
84 | this.form.clear() | ||
85 | this.form.$('invite').$('0').focus() | ||
76 | }, | 86 | }, |
77 | onError: () => {}, | 87 | onError: () => {}, |
78 | }); | 88 | }); |
@@ -81,7 +91,7 @@ export default class Invite extends Component { | |||
81 | render() { | 91 | render() { |
82 | const { form } = this; | 92 | const { form } = this; |
83 | const { intl } = this.context; | 93 | const { intl } = this.context; |
84 | const { from, embed } = this.props; | 94 | const { from, embed, success } = this.props; |
85 | 95 | ||
86 | const atLeastOneEmailAddress = form.$('invite') | 96 | const atLeastOneEmailAddress = form.$('invite') |
87 | .map(invite => invite.$('email').value) | 97 | .map(invite => invite.$('email').value) |
@@ -92,7 +102,20 @@ export default class Invite extends Component { | |||
92 | 'invite__embed--button': embed, | 102 | 'invite__embed--button': embed, |
93 | }); | 103 | }); |
94 | 104 | ||
105 | console.log(success) | ||
106 | |||
95 | return ( | 107 | return ( |
108 | <div> | ||
109 | {(success && <Appear> | ||
110 | <Infobox | ||
111 | type="success" | ||
112 | icon="checkbox-marked-circle-outline" | ||
113 | dismissable | ||
114 | > | ||
115 | Great Success! | ||
116 | </Infobox> | ||
117 | </Appear>)} | ||
118 | |||
96 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> | 119 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> |
97 | {!embed && (<img | 120 | {!embed && (<img |
98 | src="./assets/images/logo.svg" | 121 | src="./assets/images/logo.svg" |
@@ -123,6 +146,7 @@ export default class Invite extends Component { | |||
123 | {intl.formatMessage(messages.skipButtonLabel)} | 146 | {intl.formatMessage(messages.skipButtonLabel)} |
124 | </Link>)} | 147 | </Link>)} |
125 | </form> | 148 | </form> |
149 | </div> | ||
126 | ); | 150 | ); |
127 | } | 151 | } |
128 | } | 152 | } |