Use modal instead of modal context

This commit is contained in:
Igor 2019-11-14 17:25:09 -03:00
parent fe687cd2f9
commit ec7337e801
3 changed files with 5 additions and 4 deletions

View File

@ -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 }} />;
};
};

View File

@ -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 = [
{

View File

@ -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',
});