diff --git a/src/components/CenterPanel/forms/SMSForm.tsx b/src/components/CenterPanel/forms/SMSForm.tsx new file mode 100644 index 0000000..faa7ea3 --- /dev/null +++ b/src/components/CenterPanel/forms/SMSForm.tsx @@ -0,0 +1,32 @@ +import { useQR } from '../../../context/QRContext'; +import { TextareaInput } from '../../ui/TextareaInput'; + +function isValidPhone(v: string) { + if (!v.trim()) return true; + return /^\+?[\d\s\-().]{6,}$/.test(v.trim()); +} + +export function SMSForm() { + const { state, dispatch } = useQR(); + const { phoneNumber, message } = state.formData.sms; + const set = (field: string, value: string) => + dispatch({ type: 'SET_FORM_FIELD', qrType: 'sms', field, value }); + const valid = isValidPhone(phoneNumber); + + return ( +
Enter a valid phone number
} +