Skip to content

Commit c8d179b

Browse files
mcsmitherslpatmo
authored andcommitted
Prop validations (#66)
* prop-validations added * Props validations added and validation types created
1 parent 79915eb commit c8d179b

File tree

14 files changed

+95
-5
lines changed

14 files changed

+95
-5
lines changed

imports/ui/components/apply.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { timezones } from '/lib/data/timezones';
44
import { Alert, Card, Button, Form } from 'react-bootstrap';
55
import { EMAIL_REGEX } from '/imports/constants/regex';
66
import { Meteor } from 'meteor/meteor';
7+
import { PropTypes } from 'prop-types';
78

89
class Apply extends React.Component {
910
constructor(props) {
@@ -211,4 +212,9 @@ class Apply extends React.Component {
211212
}
212213
}
213214

215+
Apply.propTypes = {
216+
// We can check optional and required types here
217+
history: PropTypes.array,
218+
};
219+
214220
export default Apply;

imports/ui/components/board/board.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Container } from 'react-bootstrap';
33
import Column from './column';
44
import '/imports/ui/styles/_board.scss';
55
import { categories } from '/lib/data/categories.js';
6+
import { PropTypes } from 'prop-types';
67

78
class Board extends React.Component {
89
constructor(props) {
@@ -26,4 +27,9 @@ class Board extends React.Component {
2627
}
2728
}
2829

30+
Board.propTypes = {
31+
// We can check optional and required types here
32+
entries: PropTypes.array,
33+
};
34+
2935
export default Board;

imports/ui/components/board/column.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import Entry from './entry';
3+
import { PropTypes } from 'prop-types';
34

45
class Column extends React.Component {
56
render() {
@@ -18,4 +19,10 @@ class Column extends React.Component {
1819
}
1920
}
2021

22+
Column.propTypes = {
23+
// We can check optional and required types here
24+
entries: PropTypes.array,
25+
heading: PropTypes.string,
26+
};
27+
2128
export default Column;

imports/ui/components/board/entry.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import FavoriteIcon from '@material-ui/icons/Favorite';
33
// import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
4+
import { PropTypes } from 'prop-types';
45

56
function Entry(props) {
67
const { timezone, lookingFor, oneLineIntro } = props;
@@ -16,4 +17,10 @@ function Entry(props) {
1617
);
1718
}
1819

20+
Entry.propTypes = {
21+
// We can check optional and required types here
22+
timezone: PropTypes.string,
23+
lookingFor: PropTypes.array,
24+
oneLineIntro: PropTypes.string,
25+
};
1926
export default Entry;

imports/ui/components/dashboard/dashboard.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import DashboardSidebar from './dashboard_sidebar';
33
import MatchesSection from './matches_section';
44
import DashboardCardsSection from './dashboard_cards_section';
55
import { categories } from '/lib/data/categories.js';
6+
import { PropTypes } from 'prop-types';
67

78
const sectionTargets = {
89
//see: categories.js for numbers
@@ -95,4 +96,11 @@ class Dashboard extends Component {
9596
}
9697
}
9798

99+
Dashboard.propTypes = {
100+
entries: PropTypes.array,
101+
handleCategoryChange: PropTypes.element,
102+
currentUserName: PropTypes.string,
103+
ownEntries: PropTypes.element,
104+
};
105+
98106
export default Dashboard;

imports/ui/components/dashboard/dashboard_cards_section.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import { CardColumns, Card, Collapse } from 'react-bootstrap';
33
import MatchCard from './match_card';
4+
import { PropTypes } from 'prop-types';
45

56
class DashboardCardsSection extends Component {
67
render() {
@@ -38,4 +39,10 @@ class DashboardCardsSection extends Component {
3839
}
3940
}
4041

42+
DashboardCardsSection.propTypes = {
43+
section: PropTypes.element,
44+
visibility: PropTypes.bool,
45+
entries: PropTypes.array,
46+
};
47+
4148
export default DashboardCardsSection;

imports/ui/components/dashboard/dashboard_sidebar.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from 'react';
22
import { ListGroup } from 'react-bootstrap';
3+
import { PropTypes } from 'prop-types';
34

45
class DashboardSidebar extends Component {
56
constructor(props) {
@@ -41,4 +42,10 @@ class DashboardSidebar extends Component {
4142
}
4243
}
4344

45+
DashboardSidebar.propTypes = {
46+
onVisibilityChange: PropTypes.boolean,
47+
sections: PropTypes.element,
48+
currentUserName: PropTypes.string,
49+
};
50+
4451
export default DashboardSidebar;

imports/ui/components/dashboard/match_card.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import { Card, Dropdown, ButtonGroup, Button } from 'react-bootstrap';
33
import '/imports/ui/styles/_cards.scss';
4+
import { PropTypes } from 'prop-types';
45

56
class MatchCard extends Component {
67
constructor(props) {
@@ -38,4 +39,11 @@ class MatchCard extends Component {
3839
}
3940
}
4041

42+
MatchCard.propTypes = {
43+
oneLineIntro: PropTypes.string,
44+
lookingFor: PropTypes.string,
45+
ownCard: PropTypes.boolean,
46+
timezone: PropTypes.string,
47+
};
48+
4149
export default MatchCard;

imports/ui/components/dashboard/matches_section.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { Card, Nav, Tab } from 'react-bootstrap';
33
import MatchCard from './match_card';
4+
import { PropTypes } from 'prop-types';
45

56
const MatchesSection = props => {
67
const { ownEntries } = props;
@@ -42,4 +43,8 @@ const MatchesSection = props => {
4243
);
4344
};
4445

46+
MatchesSection.propTypes = {
47+
ownEntries: PropTypes.element,
48+
};
49+
4550
export default MatchesSection;

imports/ui/components/moderator.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { Container, Row, Col } from 'react-bootstrap';
33
import { AuthContext } from './hoc/AuthProvider';
44
import BoardContainer from '/imports/ui/containers/board.jsx';
5+
import { PropTypes } from 'prop-types';
56

67
class Moderator extends React.Component {
78
constructor(props) {
@@ -28,4 +29,9 @@ class Moderator extends React.Component {
2829
}
2930

3031
Moderator.contextType = AuthContext;
32+
33+
Moderator.propTypes = {
34+
user: PropTypes.object,
35+
};
36+
3137
export default Moderator;

0 commit comments

Comments
 (0)