Skip to content

Commit

Permalink
fix(auth): disable continue button in registration form
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Aug 4, 2021
1 parent ed31555 commit c8ccfc7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Checkbox: React.FC<Props> = ({ label, name, onChange, header, checked, val
) : null}
<div className={styles.row}>
<input name={name} type="checkbox" id={id} value={value} onChange={onChange} checked={checked} aria-required={required} disabled={disabled} />
<label htmlFor={id}>{label}</label>
<label htmlFor={id}>{required ? '* ' : ''}{label}</label>
</div>
{helperText ? <div className={styles.helperText}>{helperText}</div> : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`<Checkbox> renders and matches snapshot 1`] = `
<label
for="check-box_1235_name"
>
label
</label>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/RegistrationForm/RegistrationForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('<RegistrationForm>', () => {
consentErrors={[]}
consentValues={{}}
loading={false}
canSubmit={true}
onConsentChange={jest.fn()}
/>,
);
Expand Down
5 changes: 4 additions & 1 deletion src/components/RegistrationForm/RegistrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Props = {
consentValues: Record<string, boolean>;
consentErrors: string[];
submitting: boolean;
canSubmit: boolean;
publisherConsents?: Consent[];
};

Expand All @@ -38,6 +39,7 @@ const RegistrationForm: React.FC<Props> = ({
errors,
submitting,
loading,
canSubmit,
publisherConsents,
consentValues,
onConsentChange,
Expand Down Expand Up @@ -113,6 +115,7 @@ const RegistrationForm: React.FC<Props> = ({
name={consent.name}
value={consent.name}
error={consentErrors?.includes(consent.name)}
required={consent.required}
checked={consentValues[consent.name]}
onChange={onConsentChange}
label={formatConsentLabel(consent.label)}
Expand All @@ -125,7 +128,7 @@ const RegistrationForm: React.FC<Props> = ({
variant="contained"
color="primary"
size="large"
disabled={submitting}
disabled={submitting || !canSubmit}
fullWidth
/>
<div className={styles.bottom}>
Expand Down
1 change: 1 addition & 0 deletions src/containers/AccountModal/forms/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const Registration = () => {
publisherConsents={publisherConsents}
loading={publisherConsentsLoading}
onConsentChange={handleChangeConsent}
canSubmit={!!values.email && !!values.password}
/>
);
};
Expand Down

0 comments on commit c8ccfc7

Please sign in to comment.