1- import React , { PropTypes } from 'react' ;
1+ // @flow
2+ import React from 'react' ;
23import Layer from 'grommet/components/Layer' ;
34import Form from 'grommet/components/Form' ;
45import FormFields from 'grommet/components/FormFields' ;
@@ -10,62 +11,56 @@ import Footer from 'grommet/components/Footer';
1011import { Divider } from 'components' ;
1112import error from './utils/error' ;
1213
13- const WelcomeModal = ( {
14- onClose,
15- isVisible,
16- nameInput,
17- onSubmit,
18- } ) => (
19- < Layer
20- align = "center"
21- closer
22- hidden = { ! isVisible }
23- onClose = { onClose }
24- >
25- < Box align = "center" justify = "center" pad = "large" >
26- < Heading align = "center" >
27- What should we call you?
28- </ Heading >
29- < Divider />
30- < Form >
31- < FormFields >
32- < FormField
33- help = "What should we call you?"
34- error = { error ( nameInput ) }
35- label = "Enter your name"
36- htmlFor = "nameInput"
37- >
38- < input
39- { ...nameInput }
40- required
41- autoFocus
42- placeholder = "Ryan Collins"
43- id = "nameInput"
44- autoComplete = "on"
45- name = "name"
46- type = "text"
47- aria-invalid = { nameInput . error }
48- aria-required
49- className = "input"
50- />
51- </ FormField >
52- </ FormFields >
53- </ Form >
54- < Footer align = "center" justify = "center" pad = "large" >
55- < Button primary label = "Submit" onClick = { onSubmit } />
56- </ Footer >
57- </ Box >
58- </ Layer >
59- ) ;
60-
61- WelcomeModal . propTypes = {
62- onClose : PropTypes . func . isRequired ,
63- nameInput : PropTypes . shape ( {
64- error : PropTypes . string ,
65- value : PropTypes . string ,
66- } ) ,
67- isVisible : PropTypes . bool . isRequired ,
68- onSubmit : PropTypes . func . isRequired ,
69- } ;
70-
71- export default WelcomeModal ;
14+ export default function WelcomeModal ( props : {
15+ onClose : Function ,
16+ nameInput : {
17+ error : ?string ,
18+ value : ?string ,
19+ } ,
20+ isVisible : boolean ,
21+ onSubmit : Function ,
22+ } ) {
23+ const { onClose, nameInput, isVisible, onSubmit } = props ;
24+ return (
25+ < Layer
26+ align = "center"
27+ closer
28+ hidden = { ! isVisible }
29+ onClose = { onClose }
30+ >
31+ < Box align = "center" justify = "center" pad = "large" >
32+ < Heading align = "center" >
33+ What should we call you?
34+ </ Heading >
35+ < Divider />
36+ < Form >
37+ < FormFields >
38+ < FormField
39+ help = "What should we call you?"
40+ error = { error ( nameInput ) }
41+ label = "Enter your name"
42+ htmlFor = "nameInput"
43+ >
44+ < input
45+ { ...nameInput }
46+ required
47+ autoFocus
48+ placeholder = "Ryan Collins"
49+ id = "nameInput"
50+ autoComplete = "on"
51+ name = "name"
52+ type = "text"
53+ aria-invalid = { nameInput . error }
54+ aria-required
55+ className = "input"
56+ />
57+ </ FormField >
58+ </ FormFields >
59+ </ Form >
60+ < Footer align = "center" justify = "center" pad = "large" >
61+ < Button primary label = "Submit" onClick = { onSubmit } />
62+ </ Footer >
63+ </ Box >
64+ </ Layer >
65+ ) ;
66+ }
0 commit comments