Set input errors to be absolute and not shift the height of the component

This commit is contained in:
Daniel Cojocea committed 2024-08-27 20:47:35 -04:00
1 parent e5c19c2744
commit 999379e5ca
5 files changed
+113 -50

No files matched your search

+30 -25
View File
@@ -148,31 +148,36 @@ const ForgotPassword = () => {
No worries, we'll send you reset instructions. No worries, we'll send you reset instructions.
</Typography> </Typography>
</Box> </Box>
<Box width="100%" textAlign="left"> <Box
<form noValidate spellCheck={false} onSubmit={handleSubmit}> component="form"
<Field width="100%"
type="email" textAlign="left"
id="forgot-password-email-input" noValidate
label="Email" spellCheck={false}
isRequired={true} onSubmit={handleSubmit}
placeholder="Enter your email" >
value={form.email} <Field
onChange={handleChange} type="email"
error={errors.email} id="forgot-password-email-input"
/> label="Email"
<ButtonSpinner isRequired={true}
disabled={errors.email !== undefined} placeholder="Enter your email"
onClick={handleSubmit} value={form.email}
isLoading={isLoading} onChange={handleChange}
level="primary" error={errors.email}
label="Send instructions" />
sx={{ <ButtonSpinner
width: "100%", disabled={errors.email !== undefined}
fontWeight: 400, onClick={handleSubmit}
mt: theme.spacing(10), isLoading={isLoading}
}} level="primary"
/> label="Send instructions"
</form> sx={{
width: "100%",
fontWeight: 400,
mt: theme.spacing(15),
}}
/>
</Box> </Box>
</Stack> </Stack>
</Stack> </Stack>
+7 -3
View File
@@ -132,7 +132,7 @@ 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 textAlign="left" mb={theme.spacing(5)}>
<form noValidate spellCheck={false} onSubmit={onSubmit}> <form noValidate spellCheck={false} onSubmit={onSubmit}>
<Field <Field
type="email" type="email"
@@ -225,7 +225,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
<Typography component="h1">Log In</Typography> <Typography component="h1">Log In</Typography>
<Typography>Enter your password</Typography> <Typography>Enter your password</Typography>
</Box> </Box>
<Box textAlign="left"> <Box textAlign="left" mb={theme.spacing(5)}>
<form noValidate spellCheck={false} onSubmit={onSubmit}> <form noValidate spellCheck={false} onSubmit={onSubmit}>
<Field <Field
type="password" type="password"
@@ -266,7 +266,11 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
/> />
</Stack> </Stack>
<Box textAlign="center"> <Box textAlign="center">
<Typography className="forgot-p" display="inline-block"> <Typography
className="forgot-p"
display="inline-block"
color={theme.palette.common.main}
>
Forgot password? Forgot password?
</Typography> </Typography>
<Typography <Typography
+47 -12
View File
@@ -139,7 +139,13 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
<Typography>Enter your personal details</Typography> <Typography>Enter your personal details</Typography>
</Box> </Box>
<Box textAlign="left"> <Box textAlign="left">
<form noValidate spellCheck={false} onSubmit={onSubmit}> <Box
component="form"
noValidate
spellCheck={false}
onSubmit={onSubmit}
mb={theme.spacing(10)}
>
<Field <Field
id="register-firstname-input" id="register-firstname-input"
label="Name" label="Name"
@@ -151,8 +157,14 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
error={errors.firstName} error={errors.firstName}
ref={inputRef} ref={inputRef}
/> />
</form> </Box>
<form noValidate spellCheck={false} onSubmit={onSubmit}> <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"
@@ -163,7 +175,7 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
onChange={onChange} onChange={onChange}
error={errors.lastName} error={errors.lastName}
/> />
</form> </Box>
</Box> </Box>
<Stack direction="row" justifyContent="space-between"> <Stack direction="row" justifyContent="space-between">
<Button <Button
@@ -233,7 +245,13 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
<Typography>Enter your email address</Typography> <Typography>Enter your email address</Typography>
</Box> </Box>
<Box textAlign="left"> <Box textAlign="left">
<form noValidate spellCheck={false} onSubmit={onSubmit}> <Box
component="form"
noValidate
spellCheck={false}
onSubmit={onSubmit}
mb={theme.spacing(5)}
>
<Field <Field
type="email" type="email"
id="register-email-input" id="register-email-input"
@@ -247,7 +265,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
error={errors.email} error={errors.email}
ref={inputRef} ref={inputRef}
/> />
</form> </Box>
</Box> </Box>
<Stack direction="row" justifyContent="space-between"> <Stack direction="row" justifyContent="space-between">
<Button <Button
@@ -316,8 +334,20 @@ const StepThree = ({ form, errors, onSubmit, onChange, onBack }) => {
<Typography component="h1">Sign Up</Typography> <Typography component="h1">Sign Up</Typography>
<Typography>Create your password</Typography> <Typography>Create your password</Typography>
</Box> </Box>
<Box textAlign="left"> <Box
<form noValidate spellCheck={false} onSubmit={onSubmit}> textAlign="left"
sx={{
"& .input-error": {
display: "none",
},
}}
>
<Box
component="form"
noValidate
spellCheck={false}
onSubmit={onSubmit}
>
<Field <Field
type="password" type="password"
id="register-password-input" id="register-password-input"
@@ -330,8 +360,13 @@ const StepThree = ({ form, errors, onSubmit, onChange, onBack }) => {
error={errors.password} error={errors.password}
ref={inputRef} ref={inputRef}
/> />
</form> </Box>
<form noValidate spellCheck={false} onSubmit={onSubmit}> <Box
component="form"
noValidate
spellCheck={false}
onSubmit={onSubmit}
>
<Field <Field
type="password" type="password"
id="register-confirm-input" id="register-confirm-input"
@@ -343,10 +378,10 @@ const StepThree = ({ form, errors, onSubmit, onChange, onBack }) => {
onChange={onChange} onChange={onChange}
error={errors.confirm} error={errors.confirm}
/> />
</form> </Box>
<Stack <Stack
gap={theme.gap.small} gap={theme.gap.small}
mb={{ xs: theme.spacing(8), sm: theme.spacing(12) }} mb={{ xs: theme.spacing(6), sm: theme.spacing(8) }}
> >
<Check <Check
text={ text={
+23 -5
View File
@@ -165,8 +165,21 @@ const SetNewPassword = () => {
Your new password must be different to previously used passwords. Your new password must be different to previously used passwords.
</Typography> </Typography>
</Box> </Box>
<Box width="100%" textAlign="left"> <Box
<form noValidate spellCheck={false} onSubmit={handleSubmit}> width="100%"
textAlign="left"
sx={{
"& .input-error": {
display: "none",
},
}}
>
<Box
component="form"
noValidate
spellCheck={false}
onSubmit={handleSubmit}
>
<Field <Field
type="password" type="password"
id="register-password-input" id="register-password-input"
@@ -177,8 +190,13 @@ const SetNewPassword = () => {
onChange={handleChange} onChange={handleChange}
error={errors.password} error={errors.password}
/> />
</form> </Box>
<form noValidate spellCheck={false} onSubmit={handleSubmit}> <Box
component="form"
noValidate
spellCheck={false}
onSubmit={handleSubmit}
>
<Field <Field
type="password" type="password"
id="confirm-password-input" id="confirm-password-input"
@@ -189,7 +207,7 @@ const SetNewPassword = () => {
onChange={handleChange} onChange={handleChange}
error={errors.confirm} error={errors.confirm}
/> />
</form> </Box>
<Stack gap={theme.spacing(4)} mb={theme.spacing(12)}> <Stack gap={theme.spacing(4)} mb={theme.spacing(12)}>
<Check <Check
text={ text={
+6 -5
View File
@@ -76,11 +76,12 @@
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.forgot-password-page h1, .auth .field {
.check-email-page h1, position: relative;
.password-confirmed-page h1, }
.set-new-password-page h1 { .auth .input-error {
font-size: 22px; position: absolute;
top: calc(100% - 2px);
} }
@media (max-width: 800px) { @media (max-width: 800px) {