Skip to content

Commit 86a0586

Browse files
committed
Add missing PropTypes
1 parent c7e62a4 commit 86a0586

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

step-3/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"modules": true
1414
},
1515
"rules": {
16+
"jsx-quotes": 1,
1617
"react/display-name": 0,
1718
"react/forbid-prop-types": 1,
1819
"react/jsx-boolean-value": 1,
@@ -27,7 +28,6 @@
2728
"react/jsx-no-literals": 0,
2829
"react/jsx-no-undef": 1,
2930
"react/jsx-pascal-case": 1,
30-
"react/jsx-quotes": 1,
3131
"react/jsx-sort-prop-types": 1,
3232
"react/jsx-sort-props": 0,
3333
"react/jsx-uses-react": 1,

step-3/src/components/regions.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { PropTypes } from 'react';
22

33
const computeRegionStyle = function(region, selected) {
44
let style = {
@@ -12,6 +12,12 @@ const computeRegionStyle = function(region, selected) {
1212
}
1313

1414
const Regions = React.createClass({
15+
propTypes: {
16+
onRegionChange: PropTypes.func,
17+
regions: PropTypes.arrayOf(PropTypes.string),
18+
selected: PropTypes.string
19+
},
20+
1521
handleRegionClick(event) {
1622
this.props.onRegionChange(event.target.textContent);
1723
},
@@ -23,7 +29,8 @@ const Regions = React.createClass({
2329
this.props.regions.map(region =>
2430
<div key={region}
2531
style={computeRegionStyle(region, this.props.selected)}
26-
onClick={this.handleRegionClick}>
32+
onClick={this.handleRegionClick}
33+
>
2734
{region}
2835
</div>
2936
)

step-3/src/components/wine-app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const WineApp = React.createClass({
2727
this.loadWinesByRegion(data[0]);
2828
})
2929
.catch(response => {
30-
console.log(response);
30+
console.error(response); // eslint-disable-line
3131
});
3232
},
3333

@@ -41,7 +41,7 @@ const WineApp = React.createClass({
4141
});
4242
})
4343
.catch(response => {
44-
console.log(response);
44+
console.error(response); // eslint-disable-line
4545
});
4646
},
4747

step-3/src/components/wine-list.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { PropTypes } from 'react';
22

33
const computeWineStyle = function(region, selected) {
44
let style = {
@@ -12,6 +12,12 @@ const computeWineStyle = function(region, selected) {
1212
}
1313

1414
const WineList = React.createClass({
15+
propTypes: {
16+
onWineChange: PropTypes.func,
17+
selected: PropTypes.string,
18+
wines: PropTypes.arrayOf(PropTypes.object)
19+
},
20+
1521
handleWineClick(event) {
1622
let wineIndex = event.target.getAttribute('data-wineindex');
1723
this.props.onWineChange(this.props.wines[wineIndex]);
@@ -28,7 +34,8 @@ const WineList = React.createClass({
2834
<div key={wine.id}
2935
data-wineindex={index}
3036
style={computeWineStyle(wine, this.props.selected)}
31-
onClick={this.handleWineClick}>
37+
onClick={this.handleWineClick}
38+
>
3239
{wine.name}
3340
</div>
3441
)

step-3/src/components/wine.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ const Wine = React.createClass({
4848
}
4949
return (
5050
<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+
/>
5254
<div style={Styles.Title}>{wine.name}</div>
5355
<div style={Styles.Info}>
5456
<span style={Styles.Label}>Type</span>{wine.type}
@@ -65,6 +67,6 @@ const Wine = React.createClass({
6567
</div>
6668
)
6769
}
68-
})
70+
});
6971

7072
export default Wine;

0 commit comments

Comments
 (0)