add sync form validate
This commit is contained in:
@@ -5,9 +5,10 @@ import styles from '@/app/styles/login.module.scss';
|
||||
|
||||
interface PhoneInputProps {
|
||||
phoneState: string | undefined;
|
||||
validateHandler: (e: ChangeEvent<HTMLInputElement>) => void;
|
||||
}
|
||||
|
||||
export default function PhoneInput({ phoneState }: PhoneInputProps) {
|
||||
export default function PhoneInput({ phoneState, validateHandler }: PhoneInputProps) {
|
||||
const [phone, setPhone] = useState(phoneState ? phoneState : '');
|
||||
|
||||
const formatPhoneNumber = (value: string, isBackspace: boolean): string => {
|
||||
@@ -73,7 +74,10 @@ export default function PhoneInput({ phoneState }: PhoneInputProps) {
|
||||
className={`${styles['form-input']}`}
|
||||
placeholder="+7 (999) 123-45-67"
|
||||
value={phone}
|
||||
onChange={handleChange}
|
||||
onChange={(e) => {
|
||||
handleChange(e);
|
||||
validateHandler(e);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user