fleet/frontend/components/side_panels/ShowSidePanel.jsx
Zachary Wasserman dc4b97d15f
Fix React deprecation warnings (#1976)
- Refactor imports of PropTypes to use the prop-types package
- Upgrade dependencies that were setting off deprecation warnings
2019-01-06 17:25:33 -08:00

35 lines
768 B
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { noop } from 'lodash';
import { removeRightSidePanel, showRightSidePanel } from 'redux/nodes/app/actions';
const ShowSidePanel = (WrappedComponent) => {
class PageWithSidePanel extends Component {
static propTypes = {
dispatch: PropTypes.func,
};
static defaultProps = {
dispatch: noop,
};
componentWillMount () {
this.props.dispatch(showRightSidePanel);
}
componentWillUnmount () {
this.props.dispatch(removeRightSidePanel);
}
render () {
return <WrappedComponent {...this.props} />;
}
}
return connect()(PageWithSidePanel);
};
export default ShowSidePanel;