@@ -6,8 +6,12 @@ import StepLabel from '@material-ui/core/StepLabel';
6
6
import StepContent from '@material-ui/core/StepContent' ;
7
7
import Paper from '@material-ui/core/Paper' ;
8
8
9
- import { Button , Typography } from '@material-ui/core' ;
10
- import { ValidatorForm , TextValidator } from 'react-material-ui-form-validator' ;
9
+ import { Button , Typography , MenuItem } from '@material-ui/core' ;
10
+ import {
11
+ ValidatorForm ,
12
+ TextValidator ,
13
+ SelectValidator
14
+ } from 'react-material-ui-form-validator' ;
11
15
12
16
// import axios from 'axios';
13
17
@@ -26,12 +30,16 @@ const useStyles = makeStyles(theme => ({
26
30
padding : theme . spacing ( 3 )
27
31
} ,
28
32
textField : {
29
- marginBottom : '12px '
33
+ marginBottom : '16px '
30
34
}
31
35
} ) ) ;
32
36
33
37
function getSteps ( ) {
34
- return [ 'Profile Information' , 'Education Information' , 'Application Challenge' ] ;
38
+ return [
39
+ 'Profile Information' ,
40
+ 'Education Information' ,
41
+ 'Application Challenge'
42
+ ] ;
35
43
}
36
44
37
45
function getStepContent ( step , setActiveStep , formData , setFormData ) {
@@ -67,16 +75,16 @@ function getStepContent(step, setActiveStep, formData, setFormData) {
67
75
68
76
export function ApplicationSteps ( ) {
69
77
const classes = useStyles ( ) ;
70
- const [ activeStep , setActiveStep ] = React . useState ( 0 ) ;
78
+ const [ activeStep , setActiveStep ] = React . useState ( 2 ) ;
71
79
const [ formData , setFormData ] = React . useState ( {
72
- personal : { } ,
73
- education : { } ,
80
+ personal : { } ,
81
+ education : { } ,
74
82
challenge : { }
75
83
} ) ;
76
84
const steps = getSteps ( ) ;
77
85
78
86
const handleSubmitApplication = ( ) => {
79
- console . log ( formData )
87
+ console . log ( formData ) ;
80
88
} ;
81
89
82
90
return (
@@ -126,16 +134,29 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
126
134
return (
127
135
< ValidatorForm onSubmit = { handleSubmit } >
128
136
< TextValidator
129
- key = "name "
137
+ key = "fullName "
130
138
className = { classes . textField }
131
- label = "Full Name"
139
+ label = "Name"
132
140
variant = "outlined"
133
- value = { formData . name }
141
+ value = { formData . fullName }
134
142
fullWidth
135
- name = "name "
143
+ name = "fullName "
136
144
onChange = { handleChange }
137
145
validators = { [ 'required' ] }
138
- errorMessages = { [ 'This is a required field' ] }
146
+ errorMessages = { [ 'Name is a required field' ] }
147
+ />
148
+
149
+ < TextValidator
150
+ key = "phone"
151
+ className = { classes . textField }
152
+ label = "Phone"
153
+ variant = "outlined"
154
+ value = { formData . phone }
155
+ fullWidth
156
+ name = "phone"
157
+ onChange = { handleChange }
158
+ validators = { [ 'required' ] }
159
+ errorMessages = { [ 'Phone number is a required field' ] }
139
160
/>
140
161
141
162
< TextValidator
@@ -147,10 +168,30 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
147
168
fullWidth
148
169
name = "email"
149
170
onChange = { handleChange }
150
- validators = { [ 'required' ] }
151
- errorMessages = { [ 'This is a required field' ] }
171
+ validators = { [ 'required' , 'isEmail' ] }
172
+ errorMessages = { [
173
+ 'Email is a required field' ,
174
+ 'Must be a valid Email address'
175
+ ] }
152
176
/>
153
177
178
+ < SelectValidator
179
+ key = "gender"
180
+ className = { classes . textField }
181
+ value = { formData . gender }
182
+ onChange = { handleChange }
183
+ name = "gender"
184
+ variant = "outlined"
185
+ validators = { [ 'required' ] }
186
+ errorMessages = { [ 'Please select a gender' ] }
187
+ label = "Gender"
188
+ fullWidth
189
+ >
190
+ < MenuItem value = "male" > Male</ MenuItem >
191
+ < MenuItem value = "female" > Female</ MenuItem >
192
+ < MenuItem value = "other" > Other</ MenuItem >
193
+ </ SelectValidator >
194
+
154
195
< Button variant = "outlined" disabled color = "secondary" >
155
196
Cancel
156
197
</ Button >
@@ -163,7 +204,7 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
163
204
marginLeft : '16px'
164
205
} }
165
206
>
166
- Next
207
+ Save
167
208
</ Button >
168
209
</ ValidatorForm >
169
210
) ;
@@ -193,32 +234,66 @@ function FormEducationInfo({ setActiveStep, data, setData }) {
193
234
setActiveStep ( 2 ) ;
194
235
} ;
195
236
237
+ const years = Array ( 25 )
238
+ . fill ( 2000 )
239
+ . map ( ( x , y ) => x + y ) ;
240
+
196
241
return (
197
242
< ValidatorForm onSubmit = { handleSubmit } >
243
+ < SelectValidator
244
+ key = "year"
245
+ className = { classes . textField }
246
+ value = { formData . year }
247
+ onChange = { handleChange }
248
+ name = "year"
249
+ variant = "outlined"
250
+ validators = { [ 'required' ] }
251
+ errorMessages = { [ 'Please select your Graduation Year' ] }
252
+ label = "Graduation Year"
253
+ fullWidth
254
+ >
255
+ { years . map ( ( year , index ) => {
256
+ return < MenuItem value = { year } > { year } </ MenuItem > ;
257
+ } ) }
258
+ </ SelectValidator >
259
+
198
260
< TextValidator
199
- key = "name "
261
+ key = "college "
200
262
className = { classes . textField }
201
- label = "Full Name "
263
+ label = "College "
202
264
variant = "outlined"
203
- value = { formData . name }
265
+ value = { formData . college }
204
266
fullWidth
205
- name = "name "
267
+ name = "college "
206
268
onChange = { handleChange }
207
269
validators = { [ 'required' ] }
208
- errorMessages = { [ 'This is a required field' ] }
270
+ errorMessages = { [ 'College is a required field' ] }
209
271
/>
210
272
211
273
< TextValidator
212
- key = "email "
274
+ key = "state "
213
275
className = { classes . textField }
214
- label = "Email "
276
+ label = "State "
215
277
variant = "outlined"
216
- value = { formData . email }
278
+ value = { formData . state }
217
279
fullWidth
218
- name = "email "
280
+ name = "state "
219
281
onChange = { handleChange }
220
282
validators = { [ 'required' ] }
221
- errorMessages = { [ 'This is a required field' ] }
283
+ errorMessages = { [ 'State is a required field' ] }
284
+ />
285
+
286
+ < TextValidator
287
+ key = "country"
288
+ className = { classes . textField }
289
+ label = "Country"
290
+ variant = "outlined"
291
+ value = { formData . country }
292
+ fullWidth
293
+ name = "country"
294
+ onChange = { handleChange }
295
+ validators = { [ 'required' ] }
296
+ errorMessages = { [ 'Country is a required field' ] }
222
297
/>
223
298
224
299
< Button variant = "outlined" onClick = { handlePrev } color = "secondary" >
@@ -232,7 +307,7 @@ function FormEducationInfo({ setActiveStep, data, setData }) {
232
307
marginLeft : '16px'
233
308
} }
234
309
>
235
- Next
310
+ Save
236
311
</ Button >
237
312
</ ValidatorForm >
238
313
) ;
@@ -265,29 +340,33 @@ function FormChallenge({ setActiveStep, data, setData }) {
265
340
return (
266
341
< ValidatorForm onSubmit = { handleSubmit } >
267
342
< TextValidator
268
- key = "name"
269
343
className = { classes . textField }
270
- label = "Full Name"
271
- variant = "outlined"
272
- value = { formData . name }
344
+ multiline
273
345
fullWidth
274
- name = "name"
346
+ label = "Why ?"
347
+ variant = "outlined"
275
348
onChange = { handleChange }
276
- validators = { [ 'required' ] }
277
- errorMessages = { [ 'This is a required field' ] }
349
+ rows = { 4 }
278
350
/>
279
351
280
352
< TextValidator
281
- key = "email"
282
353
className = { classes . textField }
283
- label = "Email"
354
+ multiline
355
+ fullWidth
356
+ label = "What is your expectation from this course?"
284
357
variant = "outlined"
285
- value = { formData . email }
358
+ onChange = { handleChange }
359
+ rows = { 4 }
360
+ />
361
+
362
+ < TextValidator
363
+ className = { classes . textField }
364
+ multiline
286
365
fullWidth
287
- name = "email"
366
+ label = "What is your viewpoint toward Coding in Community Contribution?"
367
+ variant = "outlined"
288
368
onChange = { handleChange }
289
- validators = { [ 'required' ] }
290
- errorMessages = { [ 'This is a required field' ] }
369
+ rows = { 4 }
291
370
/>
292
371
293
372
< Button variant = "outlined" onClick = { handlePrev } color = "secondary" >
@@ -301,7 +380,7 @@ function FormChallenge({ setActiveStep, data, setData }) {
301
380
marginLeft : '16px'
302
381
} }
303
382
>
304
- Next
383
+ Save
305
384
</ Button >
306
385
</ ValidatorForm >
307
386
) ;
0 commit comments