feat: getting rid of tab index -1 and setting form with semantics on login and register
This commit is contained in:
1 parent
8f603d1a5d
commit
4f647028e7
5 files changed
+238
-174
No files matched your search
@@ -51,6 +51,10 @@ const LandingPage = ({ onContinue }) => {
|
|||||||
stroke: theme.palette.other.icon,
|
stroke: theme.palette.other.icon,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"&:focus-visible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Mail />
|
<Mail />
|
||||||
@@ -137,56 +141,68 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
<Typography component="h1">Log In</Typography>
|
<Typography component="h1">Log In</Typography>
|
||||||
<Typography>Enter your email address</Typography>
|
<Typography>Enter your email address</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box textAlign="left">
|
<Box
|
||||||
<form
|
textAlign="left"
|
||||||
noValidate
|
component="form"
|
||||||
spellCheck={false}
|
noValidate
|
||||||
onSubmit={onSubmit}
|
spellCheck={false}
|
||||||
>
|
onSubmit={onSubmit}
|
||||||
<Field
|
display="grid"
|
||||||
type="email"
|
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||||
id="login-email-input"
|
|
||||||
label="Email"
|
|
||||||
isRequired={true}
|
|
||||||
placeholder="jordan.ellis@domain.com"
|
|
||||||
autoComplete="email"
|
|
||||||
value={form.email}
|
|
||||||
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
|
||||||
onChange={onChange}
|
|
||||||
error={errors.email}
|
|
||||||
ref={inputRef}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</Box>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
>
|
||||||
<Button
|
<Field
|
||||||
variant="outlined"
|
type="email"
|
||||||
color="info"
|
id="login-email-input"
|
||||||
onClick={onBack}
|
label="Email"
|
||||||
sx={{
|
isRequired={true}
|
||||||
px: theme.spacing(5),
|
placeholder="jordan.ellis@domain.com"
|
||||||
"& svg.MuiSvgIcon-root": {
|
autoComplete="email"
|
||||||
mr: theme.spacing(3),
|
value={form.email}
|
||||||
},
|
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||||
}}
|
onChange={onChange}
|
||||||
props={{ tabIndex: -1 }}
|
error={errors.email}
|
||||||
|
ref={inputRef}
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<Button
|
||||||
Back
|
variant="outlined"
|
||||||
</Button>
|
color="info"
|
||||||
<Button
|
onClick={onBack}
|
||||||
variant="contained"
|
sx={{
|
||||||
color="primary"
|
px: theme.spacing(5),
|
||||||
onClick={onSubmit}
|
"& svg.MuiSvgIcon-root": {
|
||||||
disabled={errors.email && true}
|
mr: theme.spacing(3),
|
||||||
sx={{ width: "30%" }}
|
},
|
||||||
>
|
"&:focus-visible": {
|
||||||
Continue
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
</Button>
|
outlineOffset: `2px`,
|
||||||
</Stack>
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowBackRoundedIcon />
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={errors.email && true}
|
||||||
|
sx={{
|
||||||
|
width: "30%",
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
boxShadow: `none`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -285,8 +301,11 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
"& svg.MuiSvgIcon-root": {
|
"& svg.MuiSvgIcon-root": {
|
||||||
mr: theme.spacing(3),
|
mr: theme.spacing(3),
|
||||||
},
|
},
|
||||||
|
"&:focus-visible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
props={{ tabIndex: -1 }}
|
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
Back
|
||||||
@@ -294,9 +313,16 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={onSubmit}
|
type="submit"
|
||||||
disabled={errors.password && true}
|
disabled={errors.password && true}
|
||||||
sx={{ width: "30%" }}
|
sx={{
|
||||||
|
width: "30%",
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
boxShadow: `none`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
|
|||||||
stroke: theme.palette.other.icon,
|
stroke: theme.palette.other.icon,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"&:focus-visible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Mail />
|
<Mail />
|
||||||
|
|||||||
@@ -37,21 +37,28 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{/* TODO this stack should be a component */}
|
||||||
<Stack
|
<Stack
|
||||||
gap={{ xs: theme.spacing(8), sm: theme.spacing(12) }}
|
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||||
textAlign="center"
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Sign Up</Typography>
|
<Typography component="h1">Sign Up</Typography>
|
||||||
<Typography>Enter your personal details</Typography>
|
<Typography>Enter your personal details</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box textAlign="left">
|
|
||||||
|
<Box
|
||||||
|
textAlign="left"
|
||||||
|
component="form"
|
||||||
|
noValidate
|
||||||
|
spellCheck={false}
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
display="grid"
|
||||||
|
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
component="form"
|
display="grid"
|
||||||
noValidate
|
gap={{ xs: theme.spacing(8), sm: theme.spacing(12) }}
|
||||||
spellCheck={false}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
mb={theme.spacing(10)}
|
|
||||||
>
|
>
|
||||||
<Field
|
<Field
|
||||||
id="register-firstname-input"
|
id="register-firstname-input"
|
||||||
@@ -64,14 +71,6 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
error={errors.firstName}
|
error={errors.firstName}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Box
|
|
||||||
component="form"
|
|
||||||
noValidate
|
|
||||||
spellCheck={false}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
mb={theme.spacing(5)}
|
|
||||||
>
|
|
||||||
<Field
|
<Field
|
||||||
id="register-lastname-input"
|
id="register-lastname-input"
|
||||||
label="Surname"
|
label="Surname"
|
||||||
@@ -83,36 +82,48 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
error={errors.lastName}
|
error={errors.lastName}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
>
|
||||||
|
{/* TODO buttons should be a component should be a component */}
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
color="info"
|
||||||
|
onClick={onBack}
|
||||||
|
sx={{
|
||||||
|
px: theme.spacing(5),
|
||||||
|
"& svg.MuiSvgIcon-root": {
|
||||||
|
mr: theme.spacing(3),
|
||||||
|
},
|
||||||
|
|
||||||
|
"&:focus-visible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowBackRoundedIcon />
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={(errors.firstName || errors.lastName) && true}
|
||||||
|
sx={{
|
||||||
|
width: "30%",
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
boxShadow: `none`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
variant="outlined"
|
|
||||||
color="info"
|
|
||||||
onClick={onBack}
|
|
||||||
sx={{
|
|
||||||
px: theme.spacing(5),
|
|
||||||
"& svg.MuiSvgIcon-root": {
|
|
||||||
mr: theme.spacing(3),
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
props={{ tabIndex: -1 }}
|
|
||||||
>
|
|
||||||
<ArrowBackRoundedIcon />
|
|
||||||
Back
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
onClick={onSubmit}
|
|
||||||
disabled={(errors.firstName || errors.lastName) && true}
|
|
||||||
sx={{ width: "30%" }}
|
|
||||||
>
|
|
||||||
Continue
|
|
||||||
</Button>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,39 +47,44 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
textAlign="left"
|
textAlign="left"
|
||||||
|
display="grid"
|
||||||
|
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||||
sx={{
|
sx={{
|
||||||
display: "grid",
|
|
||||||
gap: theme.spacing(8),
|
|
||||||
"& .input-error": {
|
"& .input-error": {
|
||||||
display: "none",
|
display: "none",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Field
|
<Box
|
||||||
type="password"
|
display="grid"
|
||||||
id="register-password-input"
|
gap={{ xs: theme.spacing(8), sm: theme.spacing(12) }}
|
||||||
name="password"
|
>
|
||||||
label="Password"
|
<Field
|
||||||
isRequired={true}
|
type="password"
|
||||||
placeholder="Create a password"
|
id="register-password-input"
|
||||||
autoComplete="current-password"
|
name="password"
|
||||||
value={form.password}
|
label="Password"
|
||||||
onChange={handleChange}
|
isRequired={true}
|
||||||
error={errors.password && errors.password[0]}
|
placeholder="Create a password"
|
||||||
ref={inputRef}
|
autoComplete="current-password"
|
||||||
/>
|
value={form.password}
|
||||||
<Field
|
onChange={handleChange}
|
||||||
type="password"
|
error={errors.password && errors.password[0]}
|
||||||
id="register-confirm-input"
|
ref={inputRef}
|
||||||
name="confirm"
|
/>
|
||||||
label="Confirm password"
|
<Field
|
||||||
isRequired={true}
|
type="password"
|
||||||
placeholder="Confirm your password"
|
id="register-confirm-input"
|
||||||
autoComplete="current-password"
|
name="confirm"
|
||||||
value={form.confirm}
|
label="Confirm password"
|
||||||
onChange={handleChange}
|
isRequired={true}
|
||||||
error={errors.confirm && errors.confirm[0]}
|
placeholder="Confirm your password"
|
||||||
/>
|
autoComplete="current-password"
|
||||||
|
value={form.confirm}
|
||||||
|
onChange={handleChange}
|
||||||
|
error={errors.confirm && errors.confirm[0]}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
mb={{ xs: theme.spacing(6), sm: theme.spacing(8) }}
|
mb={{ xs: theme.spacing(6), sm: theme.spacing(8) }}
|
||||||
@@ -133,7 +138,6 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
outlineOffset: "4px",
|
outlineOffset: "4px",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
props={{ tabIndex: -1 }}
|
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
Back
|
||||||
@@ -147,7 +151,14 @@ function StepThree({ onSubmit, onBack }) {
|
|||||||
form.confirm.length === 0 ||
|
form.confirm.length === 0 ||
|
||||||
Object.keys(errors).length !== 0
|
Object.keys(errors).length !== 0
|
||||||
}
|
}
|
||||||
sx={{ width: "30%" }}
|
sx={{
|
||||||
|
width: "30%",
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
boxShadow: `none`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -44,58 +44,70 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
<Typography component="h1">Sign Up</Typography>
|
<Typography component="h1">Sign Up</Typography>
|
||||||
<Typography>Enter your email address</Typography>
|
<Typography>Enter your email address</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box textAlign="left">
|
|
||||||
<Box
|
<Box
|
||||||
component="form"
|
component="form"
|
||||||
noValidate
|
textAlign="left"
|
||||||
spellCheck={false}
|
noValidate
|
||||||
onSubmit={onSubmit}
|
spellCheck={false}
|
||||||
mb={theme.spacing(5)}
|
onSubmit={onSubmit}
|
||||||
>
|
mb={theme.spacing(5)}
|
||||||
<Field
|
display="grid"
|
||||||
type="email"
|
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||||
id="register-email-input"
|
|
||||||
label="Email"
|
|
||||||
isRequired={true}
|
|
||||||
placeholder="jordan.ellis@domain.com"
|
|
||||||
autoComplete="email"
|
|
||||||
value={form.email}
|
|
||||||
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
|
||||||
onChange={onChange}
|
|
||||||
error={errors.email}
|
|
||||||
ref={inputRef}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
>
|
||||||
<Button
|
<Field
|
||||||
variant="outlined"
|
type="email"
|
||||||
color="info"
|
id="register-email-input"
|
||||||
onClick={onBack}
|
label="Email"
|
||||||
sx={{
|
isRequired={true}
|
||||||
px: theme.spacing(5),
|
placeholder="jordan.ellis@domain.com"
|
||||||
"& svg.MuiSvgIcon-root": {
|
autoComplete="email"
|
||||||
mr: theme.spacing(3),
|
value={form.email}
|
||||||
},
|
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||||
}}
|
onChange={onChange}
|
||||||
props={{ tabIndex: -1 }}
|
error={errors.email}
|
||||||
|
ref={inputRef}
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
>
|
>
|
||||||
<ArrowBackRoundedIcon />
|
<Button
|
||||||
Back
|
variant="outlined"
|
||||||
</Button>
|
color="info"
|
||||||
<Button
|
onClick={onBack}
|
||||||
variant="contained"
|
sx={{
|
||||||
color="primary"
|
px: theme.spacing(5),
|
||||||
onClick={onSubmit}
|
"& svg.MuiSvgIcon-root": {
|
||||||
disabled={errors.email && true}
|
mr: theme.spacing(3),
|
||||||
sx={{ width: "30%" }}
|
},
|
||||||
>
|
"&:focus-visible": {
|
||||||
Continue
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
</Button>
|
outlineOffset: `2px`,
|
||||||
</Stack>
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowBackRoundedIcon />
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={onSubmit}
|
||||||
|
disabled={errors.email && true}
|
||||||
|
sx={{
|
||||||
|
width: "30%",
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `2px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: `2px`,
|
||||||
|
boxShadow: `none`,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user