Commit aeeea9c5 by Arjun Jhukal

minor changes

parent 0a2e890b
...@@ -12,6 +12,7 @@ interface PasswordFieldProps { ...@@ -12,6 +12,7 @@ interface PasswordFieldProps {
onChange: React.ChangeEventHandler<HTMLInputElement>; onChange: React.ChangeEventHandler<HTMLInputElement>;
onBlur: React.FocusEventHandler<HTMLInputElement>; onBlur: React.FocusEventHandler<HTMLInputElement>;
error?: string; error?: string;
required?: boolean;
} }
export default function PasswordField({ export default function PasswordField({
...@@ -22,6 +23,7 @@ export default function PasswordField({ ...@@ -22,6 +23,7 @@ export default function PasswordField({
onChange, onChange,
onBlur, onBlur,
error, error,
required = false
}: PasswordFieldProps) { }: PasswordFieldProps) {
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);
...@@ -29,7 +31,7 @@ export default function PasswordField({ ...@@ -29,7 +31,7 @@ export default function PasswordField({
const handleMouseDownPassword = (event: React.MouseEvent<HTMLButtonElement>) => event.preventDefault(); const handleMouseDownPassword = (event: React.MouseEvent<HTMLButtonElement>) => event.preventDefault();
return ( return (
<div className="input_field"> <div className="input_field">
<InputLabel htmlFor={name}>{label} <span className="text-red-500">*</span></InputLabel> <InputLabel htmlFor={name}>{label} {required && <span className="text-red-500">*</span>}</InputLabel>
<OutlinedInput <OutlinedInput
id={name} id={name}
name={name} name={name}
......
...@@ -74,7 +74,7 @@ const validationSchema = Yup.object().shape({ ...@@ -74,7 +74,7 @@ const validationSchema = Yup.object().shape({
'Password cannot start or end with spaces', 'Password cannot start or end with spaces',
(value) => value === value?.trim() (value) => value === value?.trim()
) )
.max(16, 'Password must be less than 10 characters'), .min(9, 'Password must be at least 9 characters'),
confirmPassword: Yup.string() confirmPassword: Yup.string()
.oneOf([Yup.ref('password')], 'Passwords must match') .oneOf([Yup.ref('password')], 'Passwords must match')
.required('Confirm Password is required'), .required('Confirm Password is required'),
......
...@@ -184,7 +184,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel } ...@@ -184,7 +184,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
</div> </div>
<div className="input__field"> <div className="input__field">
<InputLabel htmlFor="pob">State</InputLabel> <InputLabel htmlFor="pob">State <span className="text-red-500">*</span></InputLabel>
<Select <Select
fullWidth fullWidth
...@@ -291,6 +291,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel } ...@@ -291,6 +291,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
<div className="input__field"> <div className="input__field">
<PasswordField <PasswordField
required={id ? false : true}
name="password" name="password"
label="Password*" label="Password*"
placeholder="Enter password" placeholder="Enter password"
...@@ -303,6 +304,8 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel } ...@@ -303,6 +304,8 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
<div className="input__field"> <div className="input__field">
<PasswordField <PasswordField
required={id ? false : true}
name="password_confirmation" name="password_confirmation"
label="Confirm Password*" label="Confirm Password*"
placeholder="Confirm password" placeholder="Confirm password"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment