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 => {
|
export const withModal = Component => {
|
||||||
return function WrappedComponent(props) {
|
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,
|
t: PropTypes.func.isRequired,
|
||||||
userManager: PropTypes.object,
|
userManager: PropTypes.object,
|
||||||
user: PropTypes.object,
|
user: PropTypes.object,
|
||||||
modalContext: PropTypes.object,
|
modal: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -40,7 +40,7 @@ class Header extends Component {
|
|||||||
t,
|
t,
|
||||||
user,
|
user,
|
||||||
userManager,
|
userManager,
|
||||||
modalContext: { show },
|
modal: { show },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -287,7 +287,7 @@ function _handleBuiltIn({ behavior } = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (behavior === 'DOWNLOAD_SCREEN_SHOT') {
|
if (behavior === 'DOWNLOAD_SCREEN_SHOT') {
|
||||||
this.props.modalContext.show(ConnectedViewportDownloadForm, {
|
this.props.modal.show(ConnectedViewportDownloadForm, {
|
||||||
title: this.props.t('Download High Quality Image'),
|
title: this.props.t('Download High Quality Image'),
|
||||||
customClassName: 'ViewportDownloadForm',
|
customClassName: 'ViewportDownloadForm',
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user