Skip to content

Commit 66ad9b2

Browse files
committed
Fix #37
1 parent 51dc0bd commit 66ad9b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/components/pages/Registration.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ interface RegistrationPageProps {
4646

4747
const RegistrationPageComponent = ({user, updateCurrentUser, errorMessage, userEmail, userPassword}: RegistrationPageProps) => {
4848

49-
const [myUser, setMyUser] = useState(Object.assign({}, user, {password: ""}));
49+
const [myUser, setMyUser] = useState(Object.assign({}, user, {password: "", dateOfBirth: null}));
5050
const [unverifiedPassword, setUnverifiedPassword] = useState(userPassword ? userPassword : "");
5151
const [isValidEmail, setValidEmail] = useState(true);
52-
const [isDobValid, setIsDobValid] = useState(true);
52+
const [isDobValid, setIsDobValid] = useState(false);
5353
const [isValidPassword, setValidPassword] = useState(false);
5454
const [currentPassword, setCurrentPassword] = useState("");
5555
const [signUpAttempted, setSignUpAttempted] = useState(false);
5656
const [tempDob, setTempDob] = useState("");
57+
const [dobCheckboxChecked, setDobCheckboxChecked] = useState(false);
5758

5859
const attemptSignUp = () => {
5960
setSignUpAttempted(true);
@@ -168,6 +169,7 @@ const RegistrationPageComponent = ({user, updateCurrentUser, errorMessage, userE
168169
type="date"
169170
name="date-of-birth"
170171
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
172+
setDobCheckboxChecked(false);
171173
setTempDob(event.target.value);
172174
const dateOfBirth = event.target.value;
173175
setIsDobValid(validateDob(dateOfBirth));
@@ -179,6 +181,8 @@ const RegistrationPageComponent = ({user, updateCurrentUser, errorMessage, userE
179181
<Col lg={1}>
180182
<CustomInput
181183
disabled={tempDob != ""}
184+
checked={isDobValid || dobCheckboxChecked}
185+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDobCheckboxChecked(!dobCheckboxChecked)}
182186
id="age-confirmation-input"
183187
type="checkbox"
184188
name="age-confirmation"

0 commit comments

Comments
 (0)