change props name in input
This commit is contained in:
@@ -7,10 +7,10 @@ type Props = {
|
||||
type?: React.HTMLInputTypeAttribute,
|
||||
placeholder: string,
|
||||
icon?: React.ReactNode,
|
||||
other?: any
|
||||
field?: any
|
||||
}
|
||||
|
||||
export const Input: FC<Props> = ({ placeholder, type = "text", icon, other }) => {
|
||||
export const Input: FC<Props> = ({ placeholder, type = "text", icon, field }) => {
|
||||
const [hidden, setHidden] = useState<boolean>(false)
|
||||
const handleHidden = () => setHidden(prev => !prev)
|
||||
return (
|
||||
@@ -20,7 +20,7 @@ export const Input: FC<Props> = ({ placeholder, type = "text", icon, other }) =>
|
||||
!hidden ? <Eye size="23" color="#777577" onClick={handleHidden} /> : <EyeSlash size="23" color="#777577" onClick={handleHidden} />
|
||||
: icon}
|
||||
</div>
|
||||
<InputComponent {...other} type={type === "password" && hidden ? "text" : type} placeholder={placeholder} className="input-style" />
|
||||
<InputComponent {...field} type={type === "password" && hidden ? "text" : type} placeholder={placeholder} className="input-style" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -35,13 +35,13 @@ export const LoginForm = () => {
|
||||
<div className="flex flex-col gap-y-[25px] mt-9 mb-[42px]">
|
||||
<Controller control={control} name="phoneNumber" render={({ field }) => (
|
||||
<>
|
||||
<Input type="number" placeholder="شماره تماس" other={field} />
|
||||
<Input type="number" placeholder="شماره تماس" field={field} />
|
||||
<ErrorComponent show={errors.phoneNumber} message={errors.phoneNumber?.message} />
|
||||
</>
|
||||
)} />
|
||||
<Controller control={control} name="password" render={({ field }) => (
|
||||
<>
|
||||
<Input type="password" placeholder="رمز عبور" other={field} />
|
||||
<Input type="password" placeholder="رمز عبور" field={field} />
|
||||
<ErrorComponent show={errors.password} message={errors.password?.message} />
|
||||
</>
|
||||
)} />
|
||||
|
||||
@@ -35,11 +35,11 @@ export const ResetPasswordForm = () => {
|
||||
</div>
|
||||
<div className="flex flex-col gap-y-[25px] mt-9 mb-[42px]">
|
||||
<Controller control={control} name="password" render={({ field }) => (<>
|
||||
<Input type="password" placeholder="رمز عبور" other={field} />
|
||||
<Input type="password" placeholder="رمز عبور" field={field} />
|
||||
<ErrorComponent show={errors.password} message={errors.password?.message} />
|
||||
</>)} />
|
||||
<Controller control={control} name="repeatPassword" render={({ field }) => (<>
|
||||
<Input type="password" placeholder="تکرار رمز عبور" other={field} />
|
||||
<Input type="password" placeholder="تکرار رمز عبور" field={field} />
|
||||
<ErrorComponent show={errors.repeatPassword} message={errors.repeatPassword?.message} />
|
||||
</>)} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user