Skip to content

Commit adbc64f

Browse files
committed
Put static properties back in place
1 parent a2ee64b commit adbc64f

File tree

2 files changed

+61
-60
lines changed

2 files changed

+61
-60
lines changed

src/Pagination.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import React, { PropTypes, Component } from 'react';
44
var preventDefault = e => e.preventDefault();
55

66
export default class Pagination extends Component {
7+
8+
static defaultProps = {
9+
showPages: 5,
10+
};
11+
12+
static propTypes = {
13+
onChangePage: PropTypes.func.isRequired,
14+
totalPages: PropTypes.number.isRequired,
15+
currentPage: PropTypes.number.isRequired,
16+
showPages: PropTypes.number,
17+
};
18+
719
shouldComponentUpdate(nextProps) {
820
var props = this.props;
921

@@ -115,14 +127,3 @@ export default class Pagination extends Component {
115127
);
116128
}
117129
}
118-
119-
Pagination.defaultProps = {
120-
showPages: 5,
121-
};
122-
123-
Pagination.propTypes = {
124-
onChangePage: PropTypes.func.isRequired,
125-
totalPages: PropTypes.number.isRequired,
126-
currentPage: PropTypes.number.isRequired,
127-
showPages: PropTypes.number,
128-
};

src/Table.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,60 @@ function buildSortProps(col, sortBy, onSort) {
3939
}
4040

4141
export default class Table extends Component {
42+
4243
constructor(props) {
4344
super(props);
4445
this._headers = [];
4546
}
4647

48+
static defaultProps = {
49+
buildRowOptions: () => ({}),
50+
sortBy: {},
51+
};
52+
53+
static propTypes = {
54+
keys: PropTypes.oneOfType([
55+
PropTypes.arrayOf(PropTypes.string),
56+
PropTypes.string,
57+
]).isRequired,
58+
59+
columns: PropTypes.arrayOf(PropTypes.shape({
60+
title: PropTypes.string.isRequired,
61+
prop: PropTypes.oneOfType([
62+
PropTypes.string,
63+
PropTypes.number,
64+
]),
65+
render: PropTypes.func,
66+
sortable: PropTypes.bool,
67+
defaultContent: PropTypes.string,
68+
width: PropTypes.oneOfType([
69+
PropTypes.string,
70+
PropTypes.number,
71+
]),
72+
className: PropTypes.oneOfType([
73+
PropTypes.string,
74+
PropTypes.func,
75+
]),
76+
})).isRequired,
77+
78+
dataArray: PropTypes.arrayOf(PropTypes.oneOfType([
79+
PropTypes.array,
80+
PropTypes.object,
81+
])).isRequired,
82+
83+
buildRowOptions: PropTypes.func,
84+
85+
sortBy: PropTypes.shape({
86+
prop: PropTypes.oneOfType([
87+
PropTypes.string,
88+
PropTypes.number,
89+
]),
90+
order: PropTypes.oneOf([ 'ascending', 'descending' ]),
91+
}),
92+
93+
onSort: PropTypes.func,
94+
};
95+
4796
componentDidMount() {
4897
// If no width was specified, then set the width that the browser applied
4998
// initially to avoid recalculating width between pages.
@@ -118,52 +167,3 @@ export default class Table extends Component {
118167
}
119168

120169
}
121-
122-
123-
Table.defaultProps = {
124-
buildRowOptions: () => ({}),
125-
sortBy: {},
126-
};
127-
128-
Table.propTypes = {
129-
keys: PropTypes.oneOfType([
130-
PropTypes.arrayOf(PropTypes.string),
131-
PropTypes.string,
132-
]).isRequired,
133-
134-
columns: PropTypes.arrayOf(PropTypes.shape({
135-
title: PropTypes.string.isRequired,
136-
prop: PropTypes.oneOfType([
137-
PropTypes.string,
138-
PropTypes.number,
139-
]),
140-
render: PropTypes.func,
141-
sortable: PropTypes.bool,
142-
defaultContent: PropTypes.string,
143-
width: PropTypes.oneOfType([
144-
PropTypes.string,
145-
PropTypes.number,
146-
]),
147-
className: PropTypes.oneOfType([
148-
PropTypes.string,
149-
PropTypes.func,
150-
]),
151-
})).isRequired,
152-
153-
dataArray: PropTypes.arrayOf(PropTypes.oneOfType([
154-
PropTypes.array,
155-
PropTypes.object,
156-
])).isRequired,
157-
158-
buildRowOptions: PropTypes.func,
159-
160-
sortBy: PropTypes.shape({
161-
prop: PropTypes.oneOfType([
162-
PropTypes.string,
163-
PropTypes.number,
164-
]),
165-
order: PropTypes.oneOf([ 'ascending', 'descending' ]),
166-
}),
167-
168-
onSort: PropTypes.func,
169-
};

0 commit comments

Comments
 (0)