@nomios/web-uikit
Version:
Nomios' living web UIKit
27 lines (23 loc) • 670 B
JavaScript
import React, { PureComponent } from 'react';
import { PropTypes } from 'prop-types';
import ModalGlobalConsumer from './ModalGlobalConsumer';
const withModalGlobal = WrappedComponent => {
class WithModalGlobal extends PureComponent {
render() {
return React.createElement(ModalGlobalConsumer, null, ({
openModal,
closeModal
}) => React.createElement(WrappedComponent, Object.assign({}, this.props, {
globalModal: {
openModal,
closeModal
}
})));
}
}
WithModalGlobal.contextTypes = {
globalModal: PropTypes.object
};
return WithModalGlobal;
};
export default withModalGlobal;