From 4aa6b530228352dbcd3f6387fcd88582d7866675 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 16 Aug 2017 22:32:44 +0700 Subject: [PATCH] PropTypes for StreamTabPanel --- .../src/components/Stream.js | 4 +-- .../src/components/StreamTabPanel.js | 24 ++++++++++++---- .../src/containers/StreamTabPanel.js | 28 +++++++++++++++++-- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index a9ea98a68..26b054e0d 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -220,12 +220,12 @@ class Stream extends React.Component { tabPaneSlot={'streamTabPanes'} slotProps={slotProps} appendTabs={ - + All Comments {totalCommentCount} } appendTabPanes={ - + - {pluginTabElements} - {appendTabs} + {tabs} - {pluginTabPaneElements} - {appendTabPanes} + {tabPanes} ); } } +StreamTabPanel.propTypes = { + activeTab: PropTypes.string.isRequired, + setActiveTab: PropTypes.func.isRequired, + tabs: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.arrayOf(PropTypes.element) + ]), + tabPanes: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.arrayOf(PropTypes.element) + ]), + className: PropTypes.string, + sub: PropTypes.bool, +}; + export default StreamTabPanel; diff --git a/client/coral-embed-stream/src/containers/StreamTabPanel.js b/client/coral-embed-stream/src/containers/StreamTabPanel.js index 574c4c881..4a313d2b4 100644 --- a/client/coral-embed-stream/src/containers/StreamTabPanel.js +++ b/client/coral-embed-stream/src/containers/StreamTabPanel.js @@ -6,6 +6,7 @@ import {getSlotComponents} from 'coral-framework/helpers/plugins'; import {Tab, TabPane} from 'coral-ui'; import {getShallowChanges} from 'coral-framework/utils'; import isEqual from 'lodash/isEqual'; +import PropTypes from 'prop-types'; class StreamTabPanelContainer extends React.Component { @@ -69,14 +70,35 @@ class StreamTabPanelContainer extends React.Component { render() { return ( ); } } +StreamTabPanelContainer.propTypes = { + activeTab: PropTypes.string.isRequired, + setActiveTab: PropTypes.func.isRequired, + appendTabs: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.arrayOf(PropTypes.element) + ]), + appendTabPanes: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.arrayOf(PropTypes.element) + ]), + fallbackTab: PropTypes.string.isRequired, + tabSlot: PropTypes.string.isRequired, + tabPaneSlot: PropTypes.string.isRequired, + className: PropTypes.string, + sub: PropTypes.bool, +}; + const mapStateToProps = (state) => ({ reduxState: omit(state, 'apollo'), });