From 6afd7de789ac37dce522e4a5b63db2913d12173e Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Fri, 14 Sep 2018 13:17:28 +1200 Subject: [PATCH] All proptypes replaced with external lib --- .../src/components/IntroScreen/IntroScreen.js | 3 +- .../containers/CampaignAdmin/CampaignAdmin.js | 3 +- .../CampaignAdmin/CampaignAdminItem.js | 7 +++-- .../CampaignAdmin/CampaignAdminList.js | 29 ++++++++++--------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/client/src/components/IntroScreen/IntroScreen.js b/client/src/components/IntroScreen/IntroScreen.js index f4b72635..6d2687e0 100644 --- a/client/src/components/IntroScreen/IntroScreen.js +++ b/client/src/components/IntroScreen/IntroScreen.js @@ -1,4 +1,5 @@ -import React, { PropTypes, Component } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import i18n from 'i18n'; import CONSTANTS from 'constants/index'; diff --git a/client/src/containers/CampaignAdmin/CampaignAdmin.js b/client/src/containers/CampaignAdmin/CampaignAdmin.js index 747e5506..a28a6538 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdmin.js +++ b/client/src/containers/CampaignAdmin/CampaignAdmin.js @@ -18,6 +18,7 @@ import CampaignAdminList from './CampaignAdminList'; import IntroScreen from 'components/IntroScreen/IntroScreen'; import ResizeAware from 'react-resize-aware'; import * as viewModeActions from 'state/viewMode/ViewModeActions'; +import PropTypes from 'prop-types'; const sectionConfigKey = 'SilverStripe\\CampaignAdmin\\CampaignAdmin'; @@ -504,7 +505,7 @@ CampaignAdmin.propTypes = { }), showMessage: PropTypes.bool, previewState: PropTypes.oneOf(['edit', 'preview', 'split']), - onResize: React.PropTypes.func.isRequired, + onResize: PropTypes.func.isRequired, }; CampaignAdmin.defaultProps = { diff --git a/client/src/containers/CampaignAdmin/CampaignAdminItem.js b/client/src/containers/CampaignAdmin/CampaignAdminItem.js index 8363b2b3..71de22a2 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdminItem.js +++ b/client/src/containers/CampaignAdmin/CampaignAdminItem.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import i18n from 'i18n'; import { UncontrolledTooltip } from 'reactstrap'; import formatWrittenNumber from 'lib/formatWrittenNumber'; +import PropTypes from 'prop-types'; /** * Describes an individual campaign item @@ -162,9 +163,9 @@ class CampaignAdminItem extends Component { } CampaignAdminItem.propTypes = { - campaign: React.PropTypes.object.isRequired, - item: React.PropTypes.object.isRequired, - isLinked: React.PropTypes.bool, + campaign: PropTypes.object.isRequired, + item: PropTypes.object.isRequired, + isLinked: PropTypes.bool, }; export default CampaignAdminItem; diff --git a/client/src/containers/CampaignAdmin/CampaignAdminList.js b/client/src/containers/CampaignAdmin/CampaignAdminList.js index cbe83bc4..863884e7 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdminList.js +++ b/client/src/containers/CampaignAdmin/CampaignAdminList.js @@ -15,6 +15,7 @@ import { DropdownItem } from 'reactstrap'; import i18n from 'i18n'; import { inject } from 'lib/Injector'; import classNames from 'classnames'; +import PropTypes from 'prop-types'; /** * Represents a campaign list view @@ -520,22 +521,22 @@ class CampaignAdminList extends Component { } CampaignAdminList.propTypes = { - campaign: React.PropTypes.shape({ - isPublishing: React.PropTypes.bool, - changeSetItemId: React.PropTypes.number, + campaign: PropTypes.shape({ + isPublishing: PropTypes.bool, + changeSetItemId: PropTypes.number, }), - publishApi: React.PropTypes.func.isRequired, - record: React.PropTypes.object.isRequired, - sectionConfig: React.PropTypes.object.isRequired, - onBackButtonClick: React.PropTypes.func, - onRemoveCampaignItem: React.PropTypes.func, - breadcrumbsActions: React.PropTypes.object.isRequired, - campaignActions: React.PropTypes.object.isRequired, - recordActions: React.PropTypes.object.isRequired, - PreviewComponent: React.PropTypes.oneOfType([PropTypes.node, PropTypes.func]), - ViewModeComponent: React.PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + publishApi: PropTypes.func.isRequired, + record: PropTypes.object.isRequired, + sectionConfig: PropTypes.object.isRequired, + onBackButtonClick: PropTypes.func, + onRemoveCampaignItem: PropTypes.func, + breadcrumbsActions: PropTypes.object.isRequired, + campaignActions: PropTypes.object.isRequired, + recordActions: PropTypes.object.isRequired, + PreviewComponent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + ViewModeComponent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), FormActionComponent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), - previewState: React.PropTypes.oneOf(['edit', 'preview', 'split']), + previewState: PropTypes.oneOf(['edit', 'preview', 'split']), }; CampaignAdminList.defaultProps = {