Skip to content

Commit

Permalink
Chore: clean up prop-types (#1344)
Browse files Browse the repository at this point in the history
* Update size snapshot

* Clean up prop-types

- replaced elementType with builtin one
- removed unused custom prop type
  • Loading branch information
TrySound authored and jquense committed Jun 9, 2019
1 parent 5d93c9d commit 94e3679
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 45 deletions.
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

0 comments on commit 94e3679

Please sign in to comment.