feat(ui): Add support for Custom Modal component in Modal Service (#4752)
This commit is contained in:
1 parent
8788dae6a4
commit
2c183aa4a7
4 files changed
+33
-4
No files matched your search
@@ -39,6 +39,8 @@ const ModalProvider = ({ children, modal: Modal, service = null }) => {
|
||||
|
||||
const [options, setOptions] = useState(DEFAULT_OPTIONS);
|
||||
|
||||
const CustomModal = service.getCustomComponent();
|
||||
|
||||
/**
|
||||
* Show the modal and override its configuration props.
|
||||
*
|
||||
@@ -81,10 +83,12 @@ const ModalProvider = ({ children, modal: Modal, service = null }) => {
|
||||
contentDimensions,
|
||||
} = options;
|
||||
|
||||
const ModalComp = CustomModal ? CustomModal : Modal;
|
||||
|
||||
return (
|
||||
<Provider value={{ show, hide }}>
|
||||
{ModalContent && (
|
||||
<Modal
|
||||
<ModalComp
|
||||
className={classNames(customClassName, ModalContent.className)}
|
||||
shouldCloseOnEsc={shouldCloseOnEsc}
|
||||
isOpen={isOpen}
|
||||
@@ -101,7 +105,7 @@ const ModalProvider = ({ children, modal: Modal, service = null }) => {
|
||||
show={show}
|
||||
hide={hide}
|
||||
/>
|
||||
</Modal>
|
||||
</ModalComp>
|
||||
)}
|
||||
{children}
|
||||
</Provider>
|
||||
|
||||
Reference in new issue
Block a user