diff --git a/package.json b/package.json index a697fe6..cfe1e64 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "firebase": "^4.7.0", + "prop-types": "^15.6.0", "re-base": "^3.2.0", "react": "^16.1.1", "react-addons-css-transition-group": "^15.6.2", diff --git a/src/components/AddFishForm.js b/src/components/AddFishForm.js index b4abf04..fb7af82 100644 --- a/src/components/AddFishForm.js +++ b/src/components/AddFishForm.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; @@ -37,4 +38,8 @@ class AddFishForm extends React.Component { } } +AddFishForm.propTypes = { + addFish: PropTypes.func.isRequired +}; + export default AddFishForm; diff --git a/src/components/App.js b/src/components/App.js index b3e4c29..229d770 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -5,6 +5,9 @@ import Inventory from './Inventory'; import sampleFishes from '../sample-fishes'; import Fish from './Fish'; import base from '../base'; +import PropTypes from 'prop-types'; + + class App extends React.Component { constructor() { @@ -116,4 +119,8 @@ class App extends React.Component { } } +App.propTypes = { + match: PropTypes.object.isRequired +}; + export default App; diff --git a/src/components/Fish.js b/src/components/Fish.js index 92fbcfa..2d7b270 100644 --- a/src/components/Fish.js +++ b/src/components/Fish.js @@ -1,5 +1,7 @@ import React from 'react'; import { formatPrice } from '../helpers'; +import PropTypes from 'prop-types'; + class Fish extends React.Component { @@ -23,4 +25,10 @@ class Fish extends React.Component { } } +Fish.propTypes = { + details: PropTypes.object.isRequired, + index: PropTypes.string.isRequired, + addToOrder: PropTypes.func.isRequired, +}; + export default Fish; diff --git a/src/components/Header.js b/src/components/Header.js index 765cdc1..6901e86 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; const Header = (props) => { @@ -17,6 +18,9 @@ const Header = (props) => { ) } +Header.propTypes = { + tagline: PropTypes.string.isRequired +}; diff --git a/src/components/Inventory.js b/src/components/Inventory.js index 94642e7..330d13e 100644 --- a/src/components/Inventory.js +++ b/src/components/Inventory.js @@ -1,5 +1,6 @@ import React from 'react'; import AddFishForm from './AddFishForm'; +import PropTypes from 'prop-types'; class Inventory extends React.Component { constructor () { @@ -47,4 +48,12 @@ class Inventory extends React.Component { } } +Inventory.propTypes = { + fishes: PropTypes.object.isRequired, + updateFish: PropTypes.func.isRequired, + removeFish: PropTypes.func.isRequired, + addFish: PropTypes.func.isRequired, + loadSamples: PropTypes.func.isRequired +}; + export default Inventory; diff --git a/src/components/Order.js b/src/components/Order.js index 6a0db5f..fe234fa 100644 --- a/src/components/Order.js +++ b/src/components/Order.js @@ -1,6 +1,7 @@ import React from 'react'; import { formatPrice } from '../helpers'; import CSSTransitionGroup from 'react-addons-css-transition-group'; +import PropTypes from 'prop-types'; class Order extends React.Component { @@ -70,4 +71,10 @@ class Order extends React.Component { } } +Order.propTypes = { + fishes: PropTypes.object.isRequired, + order: PropTypes.object.isRequired, + removeFromOrder: PropTypes.func.isRequired +}; + export default Order; diff --git a/src/components/StorePicker.js b/src/components/StorePicker.js index 03d5bc2..bf04d1e 100644 --- a/src/components/StorePicker.js +++ b/src/components/StorePicker.js @@ -1,25 +1,14 @@ import React from 'react'; -//getFunName is what's called a "named import". -//note that the two dots before /helpers is because the helpers.js file is two levels up in the file tree. import {getFunName} from '../helpers.js'; - - class StorePicker extends React.Component { goToStore(event){ console.log("You changed the URL"); - //first: grab the text from the box - console.log(this.storeInput.value); - //second: transition from / to /store/:storeId const storeId = this.storeInput.value; this.props.history.push(`/store/${storeId}`) - //this.props.location - //this.props.match - // this.context.router.transitionTo(`/store/${storeId}`) - } render() { @@ -33,8 +22,6 @@ class StorePicker extends React.Component { } } -// StorePicker.contextTypes = { -// router: React.PropTypes.object -// } + export default StorePicker;