create-bestax 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -144,17 +144,16 @@ function SignupForm() {
|
|
|
144
144
|
const [email, setEmail] = useState('');
|
|
145
145
|
const [touched, setTouched] = useState(false);
|
|
146
146
|
|
|
147
|
+
const valid = /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email);
|
|
147
148
|
const error =
|
|
148
|
-
touched &&
|
|
149
|
-
? 'Please enter a valid email address.'
|
|
150
|
-
: undefined;
|
|
149
|
+
touched && !valid ? 'Please enter a valid email address.' : undefined;
|
|
151
150
|
|
|
152
151
|
return (
|
|
153
152
|
<form
|
|
154
153
|
onSubmit={e => {
|
|
155
154
|
e.preventDefault();
|
|
156
155
|
setTouched(true);
|
|
157
|
-
if (
|
|
156
|
+
if (valid) {
|
|
158
157
|
// submit…
|
|
159
158
|
}
|
|
160
159
|
}}
|
|
@@ -169,6 +168,8 @@ function SignupForm() {
|
|
|
169
168
|
message={error}
|
|
170
169
|
messageColor={error ? 'danger' : undefined}
|
|
171
170
|
iconLeftName="envelope"
|
|
171
|
+
id="signup-email"
|
|
172
|
+
labelProps={{ htmlFor: 'signup-email' }}
|
|
172
173
|
/>
|
|
173
174
|
<Button color="primary" type="submit" mt="3">
|
|
174
175
|
Sign up
|