feat: sanitizing checks to reduce code repetition

This commit is contained in:
Caio Cabral committed 2024-10-23 19:57:21 -04:00
1 parent 6905f49d3b
commit bd059720de
1 file changed
+12 -40
+12 -40
View File
@@ -114,8 +114,6 @@ const SetNewPassword = () => {
confirm: getFeedbackStatus("confirm", "different"), confirm: getFeedbackStatus("confirm", "different"),
}; };
console.log({ feedbacks });
return ( return (
<Stack <Stack
className="set-new-password-page auth" className="set-new-password-page auth"
@@ -236,59 +234,33 @@ const SetNewPassword = () => {
mb={theme.spacing(12)} mb={theme.spacing(12)}
> >
<Check <Check
text={ noHighlightText={"Must be at least"}
<> text={"8 characters long"}
<Typography component="span">Must be at least</Typography> 8
characters long
</>
}
variant={feedbacks.length} variant={feedbacks.length}
/> />
<Check <Check
text={ noHighlightText={"Must contain at least"}
<> text={"one special character"}
<Typography component="span">Must contain at least</Typography> one
special character
</>
}
variant={feedbacks.special} variant={feedbacks.special}
/> />
<Check <Check
text={ noHighlightText={"Must contain at least"}
<> text={"one number"}
<Typography component="span">Must contain at least</Typography> one
one number
</>
}
variant={feedbacks.number} variant={feedbacks.number}
/> />
<Check <Check
text={ noHighlightText={"Must contain at least"}
<> text={"one upper character"}
<Typography component="span">Must contain at least</Typography> one
upper character
</>
}
variant={feedbacks.uppercase} variant={feedbacks.uppercase}
/> />
<Check <Check
text={ noHighlightText={"Must contain at least"}
<> text={"one lower character"}
<Typography component="span">Must contain at least</Typography> one
lower character
</>
}
variant={feedbacks.lowercase} variant={feedbacks.lowercase}
/> />
<Check <Check
text={ noHighlightText={"Confirm password and password"}
<> text={"must match"}
<Typography component="span">
Confirm password and password
</Typography>{" "}
must match
</>
}
variant={feedbacks.confirm} variant={feedbacks.confirm}
/> />
</Stack> </Stack>