@@ -8,6 +8,8 @@ import { Button } from "@/components/ui/button"
88import { Input } from "@/components/ui/input"
99import { Label } from "@/components/ui/label"
1010import { useAuth } from '../context/AuthContext' ;
11+ import { REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp" ;
12+ import { InputOTP , InputOTPGroup , InputOTPSeparator , InputOTPSlot } from "@/components/ui/input-otp" ;
1113
1214interface UserAuthFormProps extends React . HTMLAttributes < HTMLDivElement > { }
1315
@@ -64,21 +66,38 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) {
6466 </ div >
6567 ) : (
6668 < div className = "grid gap-2" >
67- < div className = "grid gap-1 " >
69+ < div className = "flex justify-center items-center " >
6870 < Label className = "sr-only" htmlFor = "verificationCode" >
6971 Verification Code
7072 </ Label >
71- < Input
73+ < InputOTP
7274 id = "verificationCode"
73- placeholder = "Enter your verification code"
74- type = "text"
75+ maxLength = { 6 } pattern = { REGEXP_ONLY_DIGITS_AND_CHARS }
7576 value = { verificationCode }
76- onChange = { ( e ) => setVerificationCode ( e . target . value ) }
77- autoCapitalize = "none"
78- autoComplete = "off"
79- autoCorrect = "off"
77+ onChange = { ( value ) => setVerificationCode ( value ) }
8078 disabled = { isLoading }
81- />
79+ >
80+ < InputOTPGroup >
81+ < InputOTPSlot index = { 0 }
82+ className = "h-14 w-14 text-lg text-medium"
83+ />
84+ < InputOTPSlot index = { 1 }
85+ className = "h-14 w-14 text-lg"
86+ />
87+ < InputOTPSlot index = { 2 }
88+ className = "h-14 w-14 text-lg"
89+ />
90+ < InputOTPSlot index = { 3 }
91+ className = "h-14 w-14 text-lg"
92+ />
93+ < InputOTPSlot index = { 4 }
94+ className = "h-14 w-14 text-lg"
95+ />
96+ < InputOTPSlot index = { 5 }
97+ className = "h-14 w-14 text-lg"
98+ />
99+ </ InputOTPGroup >
100+ </ InputOTP >
82101 </ div >
83102 < Button disabled = { isLoading } >
84103 { isLoading && (
@@ -87,9 +106,10 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) {
87106 Verify Code
88107 </ Button >
89108 </ div >
90- ) }
91- </ form >
92- </ div >
109+ )
110+ }
111+ </ form >
112+ </ div >
93113 ) ;
94114
95115 // return (
0 commit comments