Change modal children order

This commit is contained in:
Igor 2019-11-14 17:40:37 -03:00
parent ec7337e801
commit e895bfb1aa
2 changed files with 5 additions and 8 deletions

View File

@ -13,7 +13,7 @@ const OHIFModal = ({
onHide,
footer: Footer,
header: Header,
children: Component,
children,
}) => (
<ReactBootstrapModal
className={classNames('modal fade themed in', className)}
@ -32,9 +32,7 @@ const OHIFModal = ({
{Header && <Header hide={onHide} />}
</ReactBootstrapModal.Header>
)}
<ReactBootstrapModal.Body>
{Component && <Component hide={onHide} />}
</ReactBootstrapModal.Body>
<ReactBootstrapModal.Body>{children}</ReactBootstrapModal.Body>
{Footer && (
<ReactBootstrapModal.Footer>
{' '}
@ -57,8 +55,6 @@ OHIFModal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
PropTypes.object,
PropTypes.func,
]).isRequired,
};

View File

@ -59,6 +59,8 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
DEFAULT_OPTIONS,
]);
const { component: Component } = options;
return (
<Provider value={{ show, hide }}>
{options.component && (
@ -76,7 +78,7 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
footer={options.footer}
header={options.header}
>
{options.component}
<Component {...options} show={show} hide={hide} />
</Modal>
)}
{children}
@ -92,7 +94,6 @@ ModalProvider.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
PropTypes.func,
]).isRequired,
modal: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),