Keep modal heading margin only when close button is shown

[MAILPOET-2777]
This commit is contained in:
Jan Jakeš
2020-06-01 16:10:00 +02:00
committed by Veljko V
parent 954de9584e
commit 88a6e501a3
3 changed files with 5 additions and 1 deletions

View File

@@ -59,7 +59,7 @@
top: 0;
z-index: $modal-header-z-index;
h3 {
.mailpoet-modal-is-dismissible & h3 {
margin-right: $modal-close-button-size + $grid-gap;
}
}

View File

@@ -31,6 +31,7 @@ function Modal({
}: Props) {
return createPortal(
<ModalOverlay
isDismissible={isDismissible}
onRequestClose={onRequestClose}
shouldCloseOnEsc={shouldCloseOnEsc}
shouldCloseOnClickOutside={shouldCloseOnClickOutside}

View File

@@ -4,6 +4,7 @@ import classnames from 'classnames';
const ESCAPE = 27;
type Props = {
isDismissible?: boolean,
shouldCloseOnEsc?: boolean,
shouldCloseOnClickOutside?: boolean,
onRequestClose?: (event: React.SyntheticEvent) => void,
@@ -12,6 +13,7 @@ type Props = {
};
function ModalOverlay({
isDismissible = true,
shouldCloseOnEsc = true,
shouldCloseOnClickOutside = true,
onRequestClose = () => {},
@@ -56,6 +58,7 @@ function ModalOverlay({
ref={overlayRef}
className={classnames(
'mailpoet-modal-screen-overlay',
isDismissible ? 'mailpoet-modal-is-dismissible' : null,
className
)}
onKeyDown={handleKeyDown}