fix: uncontrolled to controlled form

pull/3813/head
Arik Chakma 2 years ago
parent 931dac64ff
commit 0fa4533168
  1. 4
      src/components/Login/EmailLoginForm.tsx
  2. 6
      src/components/Login/EmailSignupForm.tsx
  3. 2
      src/components/Profile/ForgotPasswordForm.tsx
  4. 4
      src/components/Profile/ResetPasswordForm.tsx
  5. 6
      src/components/Setting/ChangePasswordForm.tsx
  6. 8
      src/components/Setting/UpdateProfileForm.tsx

@ -132,7 +132,7 @@ const EmailLoginForm: FunctionComponent<{}> = () => {
className="block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="john@example.com" placeholder="john@example.com"
value={email} value={email}
onChange={(e) => setEmail(String((e.target as any).value))} onInput={(e) => setEmail(String((e.target as any).value))}
/> />
<label htmlFor="password" className="sr-only"> <label htmlFor="password" className="sr-only">
Password Password
@ -146,7 +146,7 @@ const EmailLoginForm: FunctionComponent<{}> = () => {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="Enter you password" placeholder="Enter you password"
value={password} value={password}
onChange={(e) => setPassword(String((e.target as any).value))} onInput={(e) => setPassword(String((e.target as any).value))}
/> />
{message && ( {message && (

@ -65,7 +65,7 @@ const EmailSignupForm: FunctionComponent<{}> = () => {
className="block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="John Doe" placeholder="John Doe"
value={name} value={name}
onChange={(e) => setName(String((e.target as any).value))} onInput={(e) => setName(String((e.target as any).value))}
/> />
<label htmlFor="email" className="sr-only"> <label htmlFor="email" className="sr-only">
Email address Email address
@ -79,7 +79,7 @@ const EmailSignupForm: FunctionComponent<{}> = () => {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="john@example.com" placeholder="john@example.com"
value={email} value={email}
onChange={(e) => setEmail(String((e.target as any).value))} onInput={(e) => setEmail(String((e.target as any).value))}
/> />
<label htmlFor="password" className="sr-only"> <label htmlFor="password" className="sr-only">
Password Password
@ -93,7 +93,7 @@ const EmailSignupForm: FunctionComponent<{}> = () => {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="Enter you password" placeholder="Enter you password"
value={password} value={password}
onChange={(e) => setPassword(String((e.target as any).value))} onInput={(e) => setPassword(String((e.target as any).value))}
/> />
{error && ( {error && (

@ -83,7 +83,7 @@ export default function ForgotPasswordForm() {
required required
placeholder="john@example.com" placeholder="john@example.com"
value={email} value={email}
onChange={(e) => setEmail((e.target as HTMLInputElement).value)} onInput={(e) => setEmail((e.target as HTMLInputElement).value)}
/> />
{message && ( {message && (

@ -85,7 +85,7 @@ export default function ResetPasswordForm() {
minLength={6} minLength={6}
placeholder="Enter a new password" placeholder="Enter a new password"
value={password} value={password}
onChange={(e) => setPassword((e.target as HTMLInputElement).value)} onInput={(e) => setPassword((e.target as HTMLInputElement).value)}
/> />
<label <label
@ -103,7 +103,7 @@ export default function ResetPasswordForm() {
minLength={6} minLength={6}
placeholder="Confirm your new password" placeholder="Confirm your new password"
value={passwordConfirm} value={passwordConfirm}
onChange={(e) => onInput={(e) =>
setPasswordConfirm((e.target as HTMLInputElement).value) setPasswordConfirm((e.target as HTMLInputElement).value)
} }
/> />

@ -134,7 +134,7 @@ export default function ChangePasswordForm() {
minLength={6} minLength={6}
placeholder="Current password" placeholder="Current password"
value={currentPassword} value={currentPassword}
onChange={(e) => onInput={(e) =>
setCurrentPassword((e.target as HTMLInputElement).value) setCurrentPassword((e.target as HTMLInputElement).value)
} }
/> />
@ -156,7 +156,7 @@ export default function ChangePasswordForm() {
minLength={6} minLength={6}
placeholder="New password" placeholder="New password"
value={newPassword} value={newPassword}
onChange={(e) => onInput={(e) =>
setNewPassword((e.target as HTMLInputElement).value) setNewPassword((e.target as HTMLInputElement).value)
} }
/> />
@ -177,7 +177,7 @@ export default function ChangePasswordForm() {
minLength={6} minLength={6}
placeholder="New password confirm" placeholder="New password confirm"
value={newPasswordConfirmation} value={newPasswordConfirmation}
onChange={(e) => onInput={(e) =>
setNewPasswordConfirmation((e.target as HTMLInputElement).value) setNewPasswordConfirmation((e.target as HTMLInputElement).value)
} }
/> />

@ -134,7 +134,7 @@ export default function UpdateProfileForm() {
required required
placeholder="John Doe" placeholder="John Doe"
value={name} value={name}
onChange={(e) => setName((e.target as HTMLInputElement).value)} onInput={(e) => setName((e.target as HTMLInputElement).value)}
/> />
</div> </div>
<div className="flex w-full flex-col"> <div className="flex w-full flex-col">
@ -167,7 +167,7 @@ export default function UpdateProfileForm() {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="https://github.com/username" placeholder="https://github.com/username"
value={github} value={github}
onChange={(e) => setGithub((e.target as HTMLInputElement).value)} onInput={(e) => setGithub((e.target as HTMLInputElement).value)}
/> />
</div> </div>
<div className="flex w-full flex-col"> <div className="flex w-full flex-col">
@ -181,7 +181,7 @@ export default function UpdateProfileForm() {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="https://www.linkedin.com/in/username/" placeholder="https://www.linkedin.com/in/username/"
value={linkedin} value={linkedin}
onChange={(e) => setLinkedin((e.target as HTMLInputElement).value)} onInput={(e) => setLinkedin((e.target as HTMLInputElement).value)}
/> />
</div> </div>
@ -196,7 +196,7 @@ export default function UpdateProfileForm() {
className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1" className="mt-2 block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 focus:ring-2 focus:ring-black focus:ring-offset-1"
placeholder="https://example.com" placeholder="https://example.com"
value={website} value={website}
onChange={(e) => setWebsite((e.target as HTMLInputElement).value)} onInput={(e) => setWebsite((e.target as HTMLInputElement).value)}
/> />
</div> </div>

Loading…
Cancel
Save