Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proptype validation #10

Merged
merged 1 commit into from Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;