Use modal instead of modal context
This commit is contained in:
parent
fe687cd2f9
commit
ec7337e801
@ -111,7 +111,8 @@ ModalProvider.propTypes = {
|
||||
*/
|
||||
export const withModal = Component => {
|
||||
return function WrappedComponent(props) {
|
||||
return <Component {...props} modalContext={{ ...useModal() }} />;
|
||||
const { show, hide } = useModal();
|
||||
return <Component {...props} modal={{ show, hide }} />;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class Header extends Component {
|
||||
t: PropTypes.func.isRequired,
|
||||
userManager: PropTypes.object,
|
||||
user: PropTypes.object,
|
||||
modalContext: PropTypes.object,
|
||||
modal: PropTypes.object,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@ -40,7 +40,7 @@ class Header extends Component {
|
||||
t,
|
||||
user,
|
||||
userManager,
|
||||
modalContext: { show },
|
||||
modal: { show },
|
||||
} = this.props;
|
||||
this.options = [
|
||||
{
|
||||
|
||||
@ -287,7 +287,7 @@ function _handleBuiltIn({ behavior } = {}) {
|
||||
}
|
||||
|
||||
if (behavior === 'DOWNLOAD_SCREEN_SHOT') {
|
||||
this.props.modalContext.show(ConnectedViewportDownloadForm, {
|
||||
this.props.modal.show(ConnectedViewportDownloadForm, {
|
||||
title: this.props.t('Download High Quality Image'),
|
||||
customClassName: 'ViewportDownloadForm',
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user