page set code
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { useState } from "react"
|
||||
|
||||
function OTPForm({ handleOTP }) {
|
||||
|
||||
const [code, setCode] = useState('');
|
||||
|
||||
return (
|
||||
<input
|
||||
value={code}
|
||||
onChange={e => {
|
||||
const value = e.target.value
|
||||
|
||||
if (/^\d+$/.test(value) && value.length < 2) {
|
||||
setCode(value)
|
||||
handleOTP(e)
|
||||
} else {
|
||||
setCode('')
|
||||
e.target.value = ''
|
||||
}
|
||||
}}
|
||||
className={`w-12 h-12 border border-solid border-[#ADB5BD] rounded-[6px] text-center transition-all duration-500 ease-out
|
||||
outline-none focus:!border-[1px] focus:!border-solid focus:!border-[#5559CE]
|
||||
focus:!outline-[1px] focus:!outline-solid focus:!outline-[#5559CE]
|
||||
${code && '!border-[1px] !border-solid !border-[#5559CE]'}
|
||||
`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default OTPForm
|
||||
Reference in New Issue
Block a user