Permalink
Browse files

Merge pull request #630 from meetfranz/fix-invite-screen

Fix invite screen
  • Loading branch information...
adlk committed Jan 30, 2018
2 parents 7618f51 + 682a54e commit 81c4e99915fc56997ae118e8474fb2689170c2bc
Showing with 19 additions and 13 deletions.
  1. +15 −10 src/components/auth/Invite.js
  2. +1 −1 src/helpers/validation-helpers.js
  3. +3 −2 src/lib/Form.js
@@ -45,16 +45,16 @@ export default class Invite extends Component {
form = new Form({
fields: {
invite: [...Array(3).fill({
name: {
label: this.context.intl.formatMessage(messages.nameLabel),
// value: '',
placeholder: this.context.intl.formatMessage(messages.nameLabel),
},
email: {
label: this.context.intl.formatMessage(messages.emailLabel),
// value: '',
validators: [email],
placeholder: this.context.intl.formatMessage(messages.emailLabel),
fields: {
name: {
label: this.context.intl.formatMessage(messages.nameLabel),
placeholder: this.context.intl.formatMessage(messages.nameLabel),
},
email: {
label: this.context.intl.formatMessage(messages.emailLabel),
placeholder: this.context.intl.formatMessage(messages.emailLabel),
validators: [email],
},
},
})],
},
@@ -74,6 +74,10 @@ export default class Invite extends Component {
const { form } = this;
const { intl } = this.context;
const atLeastOneEmailAddress = form.$('invite')
.map(invite => invite.$('email').value)
.some(emailValue => emailValue.trim() !== '');
return (
<div className="auth__container auth__container--signup">
<form className="franz-form auth__form" onSubmit={e => this.submit(e)}>
@@ -96,6 +100,7 @@ export default class Invite extends Component {
<Button
type="submit"
className="auth__button"
disabled={!atLeastOneEmailAddress}
label={intl.formatMessage(messages.submitButtonLabel)}
/>
<Link
@@ -13,7 +13,7 @@ export function email({ field }) {
isValid = true;
}
return [isValid, `${field.label} is not a valid email address`];
return [isValid, `${field.label} not valid`];
}
export function url({ field }) {
@@ -21,8 +21,9 @@ export default class DefaultForm extends Form {
options() {
return {
validateOnInit: false,
// validateOnBlur: true,
validateOnInit: false, // default: true
// validateOnBlur: true, // default: true
// validateOnChange: true // default: false
// // validationDebounceWait: {
// // trailing: true,
// // },

0 comments on commit 81c4e99

Please sign in to comment.