From febe029ed4dd879ec1d5adf37e6217b4135a479f Mon Sep 17 00:00:00 2001 From: Jeremy Letto Date: Sun, 30 Jan 2022 19:47:10 -0600 Subject: [PATCH] use CompanyDropdown component in registration form (#4548) Co-authored-by: Jeremy Letto --- .../src/components/CountryDropdown/CountryDropdown.tsx | 4 +++- webclient/src/forms/RegisterForm/RegisterForm.tsx | 4 ++-- webclient/src/material-theme.ts | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webclient/src/components/CountryDropdown/CountryDropdown.tsx b/webclient/src/components/CountryDropdown/CountryDropdown.tsx index 0d34318c..8e322b9c 100644 --- a/webclient/src/components/CountryDropdown/CountryDropdown.tsx +++ b/webclient/src/components/CountryDropdown/CountryDropdown.tsx @@ -7,9 +7,11 @@ import { Images } from 'images/Images'; import './CountryDropdown.css'; import { CountryLabel } from 'types'; -const CountryDropdown = ({ onChange }) => { +const CountryDropdown = ({ input: { onChange } }) => { const [state, setState] = useState(''); + useEffect(() => onChange(state), [state]); + return ( Country diff --git a/webclient/src/forms/RegisterForm/RegisterForm.tsx b/webclient/src/forms/RegisterForm/RegisterForm.tsx index 342e6024..ac2f7f4a 100644 --- a/webclient/src/forms/RegisterForm/RegisterForm.tsx +++ b/webclient/src/forms/RegisterForm/RegisterForm.tsx @@ -8,7 +8,7 @@ import setFieldTouched from 'final-form-set-field-touched' import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; -import { InputField, KnownHosts } from 'components'; +import { CountryDropdown, InputField, KnownHosts } from 'components'; import { useReduxEffect } from 'hooks'; import { ServerTypes } from 'store'; import { FormKey } from 'types'; @@ -131,7 +131,7 @@ const RegisterForm = ({ onSubmit }: RegisterFormProps) => { {onEmailChange}
- +