Skip to content

Commit 31fd01b

Browse files
init
1 parent 88175a1 commit 31fd01b

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

frontend/src/components/user-auth-form.tsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { Button } from "@/components/ui/button"
88
import { Input } from "@/components/ui/input"
99
import { Label } from "@/components/ui/label"
1010
import { 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

1214
interface 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 (

frontend/tailwind.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ const config = {
7272
from: { height: "var(--radix-accordion-content-height)" },
7373
to: { height: "0" },
7474
},
75+
"caret-blink": {
76+
"0%,70%,100%": { opacity: "1" },
77+
"20%,50%": { opacity: "0" },
78+
},
7579
},
7680
animation: {
7781
"accordion-down": "accordion-down 0.2s ease-out",
7882
"accordion-up": "accordion-up 0.2s ease-out",
83+
"caret-blink": "caret-blink 1.25s ease-out infinite",
7984
},
8085
},
8186
},

0 commit comments

Comments
 (0)