feat: add show scroll option to modal

Co-authored-by: Erik Ziegler <erik.sweed@gmail.com>
Co-authored-by: Davide Punzo <punzodavide@hotmail.it>
This commit is contained in:
Igor Octaviano 2020-12-03 10:09:45 -03:00 committed by GitHub
parent ab23feefbb
commit be494a7376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -21,7 +21,7 @@ export default function getCommandsModule(servicesManager) {
const { UIModalService } = servicesManager.services; const { UIModalService } = servicesManager.services;
const WrappedDicomTagBrowser = function() { const WrappedDicomTagBrowser = function () {
return ( return (
<DicomTagBrowser <DicomTagBrowser
displaySets={displaySets} displaySets={displaySets}
@ -34,6 +34,7 @@ export default function getCommandsModule(servicesManager) {
content: WrappedDicomTagBrowser, content: WrappedDicomTagBrowser,
title: `DICOM Tag Browser`, title: `DICOM Tag Browser`,
fullscreen: true, fullscreen: true,
showScrollbar: true
}); });
}, },
}; };

View File

@ -9,6 +9,7 @@
* @property {boolean} [closeButton=true] Should the modal body render the close button. * @property {boolean} [closeButton=true] Should the modal body render the close button.
* @property {string} [title=null] Should the modal render the title independently of the body content. * @property {string} [title=null] Should the modal render the title independently of the body content.
* @property {string} [customClassName=null] The custom class to style the modal. * @property {string} [customClassName=null] The custom class to style the modal.
* @property {boolean} [showScrollbar=null] Show or hide scrollbar.
*/ */
const name = 'UIModalService'; const name = 'UIModalService';
@ -28,7 +29,7 @@ const serviceImplementation = {
/** /**
* Show a new UI modal; * Show a new UI modal;
* *
* @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, onClose, closeButton, title, customClassName } * @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, onClose, closeButton, title, customClassName, showScrollbar }
*/ */
function _show({ function _show({
content = null, content = null,
@ -40,6 +41,7 @@ function _show({
title = null, title = null,
fullscreen = false, fullscreen = false,
customClassName = null, customClassName = null,
showScrollbar = false
}) { }) {
return serviceImplementation._show({ return serviceImplementation._show({
content, content,
@ -51,6 +53,7 @@ function _show({
title, title,
fullscreen, fullscreen,
customClassName, customClassName,
showScrollbar
}); });
} }

View File

@ -27,13 +27,13 @@
&.OHIFModal-fullscreen &.OHIFModal-fullscreen
width: 95% width: 95%
&__content &__content
padding: 20px padding: 20px
max-height: 90vh; max-height: 90vh;
overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
&:not(.visibleScrollbar) &__content
overflow-x: hidden;
scrollbar-width: none; scrollbar-width: none;
-ms-overflow-style: none; -ms-overflow-style: none;
&::-webkit-scrollbar &::-webkit-scrollbar

View File

@ -34,6 +34,7 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
isOpen: true, isOpen: true,
onClose: null, onClose: null,
closeButton: true, closeButton: true,
showScrollbar: false,
title: null, title: null,
customClassName: '', customClassName: '',
fullscreen: false, fullscreen: false,
@ -81,13 +82,14 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
shouldCloseOnEsc, shouldCloseOnEsc,
fullscreen, fullscreen,
closeButton, closeButton,
showScrollbar
} = options; } = options;
return ( return (
<Provider value={{ show, hide }}> <Provider value={{ show, hide }}>
{ModalContent && ( {ModalContent && (
<Modal <Modal
className={classNames(customClassName, ModalContent.className)} className={classNames(customClassName, ModalContent.className, { 'visibleScrollbar': showScrollbar })}
shouldCloseOnEsc={shouldCloseOnEsc} shouldCloseOnEsc={shouldCloseOnEsc}
isOpen={isOpen} isOpen={isOpen}
title={title} title={title}