From 7226e0d87169d717223ed015ef43c30e9f042e7c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 9 May 2022 12:00:27 -0500 Subject: [PATCH] RegistrationForm: use FormGroup errors instead of passing hasError directly --- .../components/registration_form.tsx | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/app/soapbox/features/auth_login/components/registration_form.tsx b/app/soapbox/features/auth_login/components/registration_form.tsx index f0d095d49..096f33b49 100644 --- a/app/soapbox/features/auth_login/components/registration_form.tsx +++ b/app/soapbox/features/auth_login/components/registration_form.tsx @@ -18,8 +18,10 @@ import { useAppSelector, useAppDispatch, useSettings, useFeatures } from 'soapbo const messages = defineMessages({ username: { id: 'registration.fields.username_placeholder', defaultMessage: 'Username' }, username_hint: { id: 'registration.fields.username_hint', defaultMessage: 'Only letters, numbers, and underscores are allowed.' }, + usernameUnavailable: { id: 'registration.username_unavailable', defaultMessage: 'Username is already taken.' }, email: { id: 'registration.fields.email_placeholder', defaultMessage: 'E-Mail address' }, password: { id: 'registration.fields.password_placeholder', defaultMessage: 'Password' }, + passwordMismatch: { id: 'registration.password_mismatch', defaultMessage: "Passwords don't match." }, confirm: { id: 'registration.fields.confirm_placeholder', defaultMessage: 'Password (again)' }, agreement: { id: 'registration.agreement', defaultMessage: 'I agree to the {tos}.' }, tos: { id: 'registration.tos', defaultMessage: 'Terms of Service' }, @@ -228,13 +230,10 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { return (
- {usernameUnavailable && ( - - - - )} - - + = ({ inviteToken }) => { required /> - {passwordMismatch && ( -
- -
- )} - = ({ inviteToken }) => { autoCapitalize='off' onChange={onPasswordChange} value={params.get('password', '')} - hasError={passwordMismatch === true} required /> - + + + {birthdayRequired && (