import React from 'react' import {Validation} from "./validate.js"; import {useShopStore} from "./shop_store"; import {ShowJSON} from "./ShowJSON"; /** * Components that renders the form to request quote. */ export function OrderForm() { const { email, note, isProcessing, updateEmail, updateNote, resetEmailValidation, submitForm, submitDisabled, } = useShopStore(state => ({ email: state.email, note: state.note, isProcessing: state.isProcessing, updateEmail: state.updateEmail, updateNote: state.updateNote, submitForm: state.submitForm, submitDisabled: state.submitDisabled, resetEmailValidation: state.resetEmailValidation })); return (
0 ? 'errorField' : ''}`} type="email" placeholder="Email" onFocus={resetEmailValidation} onChange={(event) => updateEmail(event.target.value)} onBlur={(event) => updateEmail(event.target.value)} value={email.value}/> {email.error === Validation.Empty ? (
Required
) : null} {email.error === Validation.Invalid ? (
Your email is incomplete
) : null}