diff --git a/src/core/client/auth/components/SignUp.tsx b/src/core/client/auth/components/SignUp.tsx index 4428a8467..d4c8a7d55 100644 --- a/src/core/client/auth/components/SignUp.tsx +++ b/src/core/client/auth/components/SignUp.tsx @@ -2,7 +2,14 @@ import * as React from "react"; import { StatelessComponent } from "react"; import { Field, Form } from "react-final-form"; import { OnSubmit } from "talk-framework/lib/form"; -import { required } from "talk-framework/lib/validation"; +import { + composeValidators, + required, + validateEmail, + validateEqualPasswords, + validatePassword, + validateUsername, +} from "talk-framework/lib/validation"; import * as styles from "./SignUp.css"; import { @@ -12,6 +19,7 @@ import { InputLabel, TextField, Typography, + ValidationMessage, } from "talk-ui/components"; interface FormProps { @@ -36,7 +44,10 @@ const SignUp: StatelessComponent = props => { Sign up to join the conversation - + {({ input, meta }) => ( Email Address @@ -46,29 +57,100 @@ const SignUp: StatelessComponent = props => { value={input.value} placeholder="Email Address" /> + {meta.touched && + (meta.error || meta.submitError) && ( + + {meta.error || meta.submitError} + + )} )} - - Username - - A unique identifier displayed on your comments. You may use - “_” and “.” - - - - - Password - - Must be at least 8 characters - - - - - Confirm Password - - + + {({ input, meta }) => ( + + Username + + A unique identifier displayed on your comments. You may + use “_” and “.” + + + {meta.touched && + (meta.error || meta.submitError) && ( + + {meta.error || meta.submitError} + + )} + + )} + + + + {({ input, meta }) => ( + + Password + + Must be at least 8 characters + + + {meta.touched && + (meta.error || meta.submitError) && ( + + {meta.error || meta.submitError} + + )} + + )} + + + + {({ input, meta }) => ( + + Confirm Password + + Must be at least 8 characters + + + {meta.touched && + (meta.error || meta.submitError) && ( + + {meta.error || meta.submitError} + + )} + + )} +