diff --git a/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx b/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx index b3182fe..1549041 100644 --- a/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx @@ -12,9 +12,11 @@ type InputProps = { desc: string; Icon: FC<{ color: string; backgroundColor: string }>; onChange: TextFieldProps["onChange"]; + onChangePhone?: (phone: string) => void; id: string; isPhone?: boolean; type?: HTMLInputTypeAttribute; + value?: string; }; const TextField = MuiTextField as unknown as FC; @@ -37,7 +39,7 @@ function phoneChange(e: ChangeEvent, mask: string) { return a || ""; } -export const CustomInput = ({ title, desc, Icon, onChange, isPhone, type, value }: InputProps) => { +export const CustomInput = ({ title, desc, Icon, onChange, onChangePhone, isPhone, type, value }: InputProps) => { const theme = useTheme(); const isMobile = useRootContainerSize() < 600; const { settings } = useQuizSettings(); @@ -58,7 +60,7 @@ export const CustomInput = ({ title, desc, Icon, onChange, isPhone, type, value ) => onChange(phoneChange(e, mask)) : onChange} + onChange={isPhone ? (e: ChangeEvent) => onChangePhone(phoneChange(e, mask)) : onChange(e)} type={isPhone ? "tel" : type} value={value} sx={{ diff --git a/lib/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx b/lib/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx index 0a9c28c..456a800 100644 --- a/lib/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx @@ -62,7 +62,8 @@ export const Inputs = ({ ); const Phone = ( { + onChange={({ target }) => setText(target.value)} + onChangePhone={(phone: string) => { console.log("onChange of phone"); console.log(phone); setPhone(phone);