import React from 'react' import {validateEmail, Validation} from "./validate.js"; import {useShopStore} from "./shop_store"; /** * Components that renders the form to request quote. */ export function OrderForm() { const { email, note, isProcessing, isProcessingComplete, showDescription, updateEmail, updateNote, submitForm, } = useShopStore(state => ({ email: state.email, note: state.note, isProcessing: state.isProcessing, isProcessingComplete: state.isProcessingComplete, showDescription: state.showDescription, updateEmail: state.updateEmail, updateNote: state.updateNote, submitForm: state.submitForm, })); return (
0 ? 'errorField' : ''}`} type="email" placeholder="Email" 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}