Keep modal heading margin only when close button is shown
[MAILPOET-2777]
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
z-index: $modal-header-z-index;
|
z-index: $modal-header-z-index;
|
||||||
|
|
||||||
h3 {
|
.mailpoet-modal-is-dismissible & h3 {
|
||||||
margin-right: $modal-close-button-size + $grid-gap;
|
margin-right: $modal-close-button-size + $grid-gap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,7 @@ function Modal({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<ModalOverlay
|
<ModalOverlay
|
||||||
|
isDismissible={isDismissible}
|
||||||
onRequestClose={onRequestClose}
|
onRequestClose={onRequestClose}
|
||||||
shouldCloseOnEsc={shouldCloseOnEsc}
|
shouldCloseOnEsc={shouldCloseOnEsc}
|
||||||
shouldCloseOnClickOutside={shouldCloseOnClickOutside}
|
shouldCloseOnClickOutside={shouldCloseOnClickOutside}
|
||||||
|
@@ -4,6 +4,7 @@ import classnames from 'classnames';
|
|||||||
const ESCAPE = 27;
|
const ESCAPE = 27;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
isDismissible?: boolean,
|
||||||
shouldCloseOnEsc?: boolean,
|
shouldCloseOnEsc?: boolean,
|
||||||
shouldCloseOnClickOutside?: boolean,
|
shouldCloseOnClickOutside?: boolean,
|
||||||
onRequestClose?: (event: React.SyntheticEvent) => void,
|
onRequestClose?: (event: React.SyntheticEvent) => void,
|
||||||
@@ -12,6 +13,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function ModalOverlay({
|
function ModalOverlay({
|
||||||
|
isDismissible = true,
|
||||||
shouldCloseOnEsc = true,
|
shouldCloseOnEsc = true,
|
||||||
shouldCloseOnClickOutside = true,
|
shouldCloseOnClickOutside = true,
|
||||||
onRequestClose = () => {},
|
onRequestClose = () => {},
|
||||||
@@ -56,6 +58,7 @@ function ModalOverlay({
|
|||||||
ref={overlayRef}
|
ref={overlayRef}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'mailpoet-modal-screen-overlay',
|
'mailpoet-modal-screen-overlay',
|
||||||
|
isDismissible ? 'mailpoet-modal-is-dismissible' : null,
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
Reference in New Issue
Block a user