From 94e36798ca8e6aa19dd345868b9f3e8cb22acbd8 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Sun, 9 Jun 2019 15:03:18 +0300 Subject: [PATCH] Chore: clean up prop-types (#1344) * Update size snapshot * Clean up prop-types - replaced elementType with builtin one - removed unused custom prop type --- .size-snapshot.json | 24 ++++++++++++------------ src/Calendar.js | 37 ++++++++++++++++++------------------- src/utils/propTypes.js | 15 +-------------- 3 files changed, 31 insertions(+), 45 deletions(-) diff --git a/.size-snapshot.json b/.size-snapshot.json index a49ffd8a1..b39052e42 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -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 } } } diff --git a/src/Calendar.js b/src/Calendar.js index 8da45977a..8a773351b 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -4,7 +4,6 @@ import uncontrollable from 'uncontrollable' import cn from 'classnames' import { accessor, - elementType, dateFormat, dateRangeFormat, views as componentViews, @@ -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, }), }), diff --git a/src/utils/propTypes.js b/src/utils/propTypes.js index 3cefebbab..0e5ce87a3 100644 --- a/src/utils/propTypes.js +++ b/src/utils/propTypes.js @@ -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]) @@ -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