File tree Expand file tree Collapse file tree 5 files changed +25
-9
lines changed Expand file tree Collapse file tree 5 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 13
13
"modules": true
14
14
},
15
15
"rules": {
16
+ "jsx-quotes": 1,
16
17
"react/display-name": 0,
17
18
"react/forbid-prop-types": 1,
18
19
"react/jsx-boolean-value": 1,
27
28
"react/jsx-no-literals": 0,
28
29
"react/jsx-no-undef": 1,
29
30
"react/jsx-pascal-case": 1,
30
- "react/jsx-quotes": 1,
31
31
"react/jsx-sort-prop-types": 1,
32
32
"react/jsx-sort-props": 0,
33
33
"react/jsx-uses-react": 1,
Original file line number Diff line number Diff line change 1
- import React from 'react'
1
+ import React , { PropTypes } from 'react' ;
2
2
3
3
const computeRegionStyle = function ( region , selected ) {
4
4
let style = {
@@ -12,6 +12,12 @@ const computeRegionStyle = function(region, selected) {
12
12
}
13
13
14
14
const Regions = React . createClass ( {
15
+ propTypes : {
16
+ onRegionChange : PropTypes . func ,
17
+ regions : PropTypes . arrayOf ( PropTypes . string ) ,
18
+ selected : PropTypes . string
19
+ } ,
20
+
15
21
handleRegionClick ( event ) {
16
22
this . props . onRegionChange ( event . target . textContent ) ;
17
23
} ,
@@ -23,7 +29,8 @@ const Regions = React.createClass({
23
29
this . props . regions . map ( region =>
24
30
< div key = { region }
25
31
style = { computeRegionStyle ( region , this . props . selected ) }
26
- onClick = { this . handleRegionClick } >
32
+ onClick = { this . handleRegionClick }
33
+ >
27
34
{ region }
28
35
</ div >
29
36
)
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const WineApp = React.createClass({
27
27
this . loadWinesByRegion ( data [ 0 ] ) ;
28
28
} )
29
29
. catch ( response => {
30
- console . log ( response ) ;
30
+ console . error ( response ) ; // eslint-disable-line
31
31
} ) ;
32
32
} ,
33
33
@@ -41,7 +41,7 @@ const WineApp = React.createClass({
41
41
} ) ;
42
42
} )
43
43
. catch ( response => {
44
- console . log ( response ) ;
44
+ console . error ( response ) ; // eslint-disable-line
45
45
} ) ;
46
46
} ,
47
47
Original file line number Diff line number Diff line change 1
- import React from 'react'
1
+ import React , { PropTypes } from 'react' ;
2
2
3
3
const computeWineStyle = function ( region , selected ) {
4
4
let style = {
@@ -12,6 +12,12 @@ const computeWineStyle = function(region, selected) {
12
12
}
13
13
14
14
const WineList = React . createClass ( {
15
+ propTypes : {
16
+ onWineChange : PropTypes . func ,
17
+ selected : PropTypes . string ,
18
+ wines : PropTypes . arrayOf ( PropTypes . object )
19
+ } ,
20
+
15
21
handleWineClick ( event ) {
16
22
let wineIndex = event . target . getAttribute ( 'data-wineindex' ) ;
17
23
this . props . onWineChange ( this . props . wines [ wineIndex ] ) ;
@@ -28,7 +34,8 @@ const WineList = React.createClass({
28
34
< div key = { wine . id }
29
35
data-wineindex = { index }
30
36
style = { computeWineStyle ( wine , this . props . selected ) }
31
- onClick = { this . handleWineClick } >
37
+ onClick = { this . handleWineClick }
38
+ >
32
39
{ wine . name }
33
40
</ div >
34
41
)
Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ const Wine = React.createClass({
48
48
}
49
49
return (
50
50
< div style = { Styles . Card } >
51
- < img style = { Styles . Image } src = { `http://localhost:3000/api/wines/${ wine . id } /image` } />
51
+ < img style = { Styles . Image }
52
+ src = { `http://localhost:3000/api/wines/${ wine . id } /image` }
53
+ />
52
54
< div style = { Styles . Title } > { wine . name } </ div >
53
55
< div style = { Styles . Info } >
54
56
< span style = { Styles . Label } > Type</ span > { wine . type }
@@ -65,6 +67,6 @@ const Wine = React.createClass({
65
67
</ div >
66
68
)
67
69
}
68
- } )
70
+ } ) ;
69
71
70
72
export default Wine ;
You can’t perform that action at this time.
0 commit comments