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

Clean up prop-types #1344

Merged
merged 2 commits into from
Jun 9, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"./dist/react-big-calendar.js": {
"bundled": 561778,
"minified": 171458,
"gzipped": 50401
"bundled": 561903,
"minified": 171545,
"gzipped": 50435
},
"./dist/react-big-calendar.min.js": {
"bundled": 498115,
"minified": 152108,
"gzipped": 45892
"bundled": 498126,
"minified": 152147,
"gzipped": 45902
},
"dist/react-big-calendar.esm.js": {
"bundled": 169709,
"minified": 81572,
"gzipped": 20100,
"bundled": 169800,
"minified": 81627,
"gzipped": 20102,
"treeshaked": {
"rollup": {
"code": 63051,
"import_statements": 1466
"code": 63039,
"import_statements": 1418
},
"webpack": {
"code": 66570
"code": 66506
}
}
}
Expand Down
37 changes: 18 additions & 19 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import uncontrollable from 'uncontrollable'
import cn from 'classnames'
import {
accessor,
elementType,
dateFormat,
dateRangeFormat,
views as componentViews,
Expand Down Expand Up @@ -670,34 +669,34 @@ class Calendar extends React.Component {
* ```
*/
components: PropTypes.shape({
event: elementType,
eventWrapper: elementType,
eventContainerWrapper: elementType,
dateCellWrapper: elementType,
timeSlotWrapper: elementType,
timeGutterHeader: elementType,
resourceHeader: elementType,
event: PropTypes.elementType,
eventWrapper: PropTypes.elementType,
eventContainerWrapper: PropTypes.elementType,
dateCellWrapper: PropTypes.elementType,
timeSlotWrapper: PropTypes.elementType,
timeGutterHeader: PropTypes.elementType,
resourceHeader: PropTypes.elementType,

toolbar: elementType,
toolbar: PropTypes.elementType,

agenda: PropTypes.shape({
date: elementType,
time: elementType,
event: elementType,
date: PropTypes.elementType,
time: PropTypes.elementType,
event: PropTypes.elementType,
}),

day: PropTypes.shape({
header: elementType,
event: elementType,
header: PropTypes.elementType,
event: PropTypes.elementType,
}),
week: PropTypes.shape({
header: elementType,
event: elementType,
header: PropTypes.elementType,
event: PropTypes.elementType,
}),
month: PropTypes.shape({
header: elementType,
dateHeader: elementType,
event: elementType,
header: PropTypes.elementType,
dateHeader: PropTypes.elementType,
event: PropTypes.elementType,
}),
}),

Expand Down
15 changes: 1 addition & 14 deletions src/utils/propTypes.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
import PropTypes from 'prop-types'
import elementType from 'prop-types-extra/lib/elementType'
import all from 'prop-types-extra/lib/all'
import { views as Views } from './constants'

export { elementType }

export let eventComponent = PropTypes.oneOfType([
elementType,
PropTypes.shape({
month: elementType,
week: elementType,
day: elementType,
agenda: elementType,
}),
])

let viewNames = Object.keys(Views).map(k => Views[k])

export let accessor = PropTypes.oneOfType([PropTypes.string, PropTypes.func])
Expand Down Expand Up @@ -50,7 +37,7 @@ export let views = PropTypes.oneOfType([
let isBuiltinView =
viewNames.indexOf(key) !== -1 && typeof prop[key] === 'boolean'

return isBuiltinView || !(err = elementType(prop, key, ...args))
return isBuiltinView || !(err = PropTypes.elementType(prop, key, ...args))
})

return err || null
Expand Down