* E2E Tests: Download Image File Modal * CI fix * Fixes for PR comments * Small change just to check CI behavior * Fix for CI failure: comparing classes instead of image src * Fixed Download button test and blocked Download Dialog event * Deleting file ConnectedViewportDownloadForm.js This file was not supposed to be created by this PR. It was already deleted by another user on Master branch. * Removing wrong import line * Fixes based on PR comments * Fixes based on PR comments * test: remove assignment to window
77 lines
1.5 KiB
JavaScript
77 lines
1.5 KiB
JavaScript
import React from 'react';
|
||
import PropTypes from 'prop-types';
|
||
import Modal from 'react-modal';
|
||
import classNames from 'classnames';
|
||
|
||
import './OHIFModal.styl';
|
||
|
||
const customStyle = {
|
||
overlay: {
|
||
zIndex: 1071,
|
||
backgroundColor: 'rgb(0, 0, 0, 0.5)',
|
||
display: 'flex',
|
||
alignItems: 'center',
|
||
justifyContent: 'center',
|
||
},
|
||
};
|
||
|
||
Modal.setAppElement(document.getElementById('root'));
|
||
|
||
const OHIFModal = ({
|
||
className,
|
||
closeButton,
|
||
shouldCloseOnEsc,
|
||
isOpen,
|
||
title,
|
||
onClose,
|
||
children,
|
||
}) => {
|
||
const renderHeader = () => {
|
||
return (
|
||
title && (
|
||
<div className="OHIFModal__header" data-cy="modal-header">
|
||
<h4>{title}</h4>
|
||
{closeButton && (
|
||
<button data-cy="close-button" onClick={onClose}>
|
||
×
|
||
</button>
|
||
)}
|
||
</div>
|
||
)
|
||
);
|
||
};
|
||
|
||
return (
|
||
<Modal
|
||
className={classNames('OHIFModal', className)}
|
||
data-cy="modal"
|
||
shouldCloseOnEsc={shouldCloseOnEsc}
|
||
isOpen={isOpen}
|
||
title={title}
|
||
style={customStyle}
|
||
>
|
||
<>
|
||
{renderHeader()}
|
||
<div className="OHIFModal__content" data-cy="modal-content">
|
||
{children}
|
||
</div>
|
||
</>
|
||
</Modal>
|
||
);
|
||
};
|
||
|
||
OHIFModal.propTypes = {
|
||
className: PropTypes.string,
|
||
closeButton: PropTypes.bool,
|
||
shouldCloseOnEsc: PropTypes.bool,
|
||
isOpen: PropTypes.bool,
|
||
title: PropTypes.string,
|
||
onClose: PropTypes.func,
|
||
children: PropTypes.oneOfType([
|
||
PropTypes.arrayOf(PropTypes.node),
|
||
PropTypes.node,
|
||
]).isRequired,
|
||
};
|
||
|
||
export default OHIFModal;
|