diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/plugins/pluggable | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/plugins/pluggable')
-rw-r--r-- | webapp/plugins/pluggable/index.js | 17 | ||||
-rw-r--r-- | webapp/plugins/pluggable/pluggable.jsx | 57 |
2 files changed, 0 insertions, 74 deletions
diff --git a/webapp/plugins/pluggable/index.js b/webapp/plugins/pluggable/index.js deleted file mode 100644 index d00f18a5d..000000000 --- a/webapp/plugins/pluggable/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {connect} from 'react-redux'; -import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; - -import Pluggable from './pluggable.jsx'; - -function mapStateToProps(state, ownProps) { - return { - ...ownProps, - components: state.plugins.components, - theme: getTheme(state) - }; -} - -export default connect(mapStateToProps)(Pluggable); diff --git a/webapp/plugins/pluggable/pluggable.jsx b/webapp/plugins/pluggable/pluggable.jsx deleted file mode 100644 index c81d8df5e..000000000 --- a/webapp/plugins/pluggable/pluggable.jsx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -// EXPERIMENTAL - SUBJECT TO CHANGE - -import React from 'react'; -import PropTypes from 'prop-types'; - -export default class Pluggable extends React.PureComponent { - static propTypes = { - - /* - * Should be a single overridable React component - */ - children: PropTypes.element.isRequired, - - /* - * Components for overriding provided by plugins - */ - components: PropTypes.object.isRequired, - - /* - * Logged in user's theme - */ - theme: PropTypes.object.isRequired - } - - render() { - const child = React.Children.only(this.props.children).type; - const components = this.props.components; - - if (child == null) { - return null; - } - - const childName = child.getComponentName(); - - // Include any props passed to this component or to the child component - let props = {...this.props}; - Reflect.deleteProperty(props, 'children'); - Reflect.deleteProperty(props, 'components'); - props = {...props, ...this.props.children.props}; - - // Override the default component with any registered plugin's component - if (components.hasOwnProperty(childName)) { - const PluginComponent = components[childName]; - return ( - <PluginComponent - {...props} - theme={this.props.theme} - /> - ); - } - - return React.cloneElement(this.props.children, {...props}); - } -} |