Skip to content

Commit

Permalink
add proptype validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tejiri4 committed Oct 19, 2019
1 parent 767dbb4 commit 266daa7
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react": "^16.10",
"react-dom": "^16.10",
"react-modal": "^3.10.1",
Expand Down
1 change: 1 addition & 0 deletions src/components/AppModal/index.jsx
@@ -1,3 +1,4 @@
// react-libraries
import Modal from "react-modal";
import React, { Component } from "react";
import { withRouter } from "react-router";
Expand Down
8 changes: 8 additions & 0 deletions src/components/Button/index.jsx
@@ -1,6 +1,9 @@
// react libraries
import React from "react";

// external libraries
import PropTypes from 'prop-types';

// styles
import "./Button.scss";

Expand Down Expand Up @@ -43,3 +46,8 @@ export const FacebookButton = () => {
</div>
);
};

Button.propTypes = {
text: PropTypes.string,
handleClick: PropTypes.func
}
11 changes: 11 additions & 0 deletions src/components/DestinationCard/index.jsx
@@ -1,6 +1,9 @@
// react libraries
import React from "react";

// external libraries
import PropTypes from 'prop-types';

// styles
import "./DestinationCard.scss";

Expand Down Expand Up @@ -60,4 +63,12 @@ const DestinationCard = ({
);
};

DestinationCard.propTypes = {
title: PropTypes.string,
address: PropTypes.string,
destinationImage: PropTypes.string,
likesNo: PropTypes.number,
ratingNo: PropTypes.number
}

export default DestinationCard;
11 changes: 11 additions & 0 deletions src/components/Input/index.jsx
@@ -1,6 +1,9 @@
// react libraries
import React from "react";

// external libraries
import PropTypes from 'prop-types';

// styles
import "./Input.scss";

Expand All @@ -17,4 +20,12 @@ const Input = ({ type, placeholder, style, required, handleOnChange }) => {
);
};

Input.propTypes = {
type: PropTypes.string,
placeholder: PropTypes.string,
style: PropTypes.object,
required: PropTypes.bool,
handleOnChange: PropTypes.func
}

export default Input;
2 changes: 1 addition & 1 deletion src/components/LoginNavigation/LoginNavigation.scss
Expand Up @@ -45,7 +45,7 @@
padding: 0 rem(120px) 0 rem(40px);
}

@include sm {
@include md {
display: none;
}
}
9 changes: 9 additions & 0 deletions src/pages/Home/index.jsx
Expand Up @@ -4,6 +4,9 @@ import { Link } from 'react-router-dom'
// styles
import "./Home.scss";

// external libraries
import PropTypes from 'prop-types';

// components
import DestinationCard from "../../components/DestinationCard";
import { Button } from "../../components/Button";
Expand Down Expand Up @@ -117,4 +120,10 @@ class Home extends Component {
}
}

Home.propTypes = {
history: PropTypes.shape({
push: PropTypes.func.isRequired
}).isRequired,
}

export default Home;

0 comments on commit 266daa7

Please sign in to comment.