Remove displayTitle prop, use title only

[MAILPOET-2777]
This commit is contained in:
Jan Jakeš
2020-05-28 12:25:20 +02:00
committed by Veljko V
parent 0a68713bf4
commit c07819e465
2 changed files with 11 additions and 19 deletions

View File

@@ -10,11 +10,9 @@ const ModalHeader = ({
}) => (
<div className="mailpoet-modal-header">
<div className="mailpoet-modal-header-heading-container">
{ title && (
<h1 className="mailpoet-modal-header-heading">
{ title }
</h1>
) }
<h1 className="mailpoet-modal-header-heading">
{ title }
</h1>
</div>
{ isDismissible && (
<button type="button" onClick={onClose} className="mailpoet-modal-close">{closeIcon}</button>
@@ -23,13 +21,12 @@ const ModalHeader = ({
);
ModalHeader.propTypes = {
title: PropTypes.string,
title: PropTypes.string.isRequired,
onClose: PropTypes.func,
isDismissible: PropTypes.bool,
};
ModalHeader.defaultProps = {
title: null,
onClose: () => {},
isDismissible: true,
};

View File

@@ -8,7 +8,6 @@ import ModalHeader from './header.jsx';
function Modal({
onRequestClose,
title,
displayTitle,
children,
isDismissible,
shouldCloseOnEsc,
@@ -32,15 +31,13 @@ function Modal({
className="mailpoet-modal-content"
role="document"
>
{
displayTitle && (
<ModalHeader
isDismissible={isDismissible}
onClose={onRequestClose}
title={title}
/>
)
}
{ title && (
<ModalHeader
isDismissible={isDismissible}
onClose={onRequestClose}
title={title}
/>
) }
{ children }
</div>
</ModalFrame>,
@@ -55,7 +52,6 @@ Modal.propTypes = {
overlayClassName: PropTypes.string,
title: PropTypes.string,
onRequestClose: PropTypes.func,
displayTitle: PropTypes.bool,
fullScreen: PropTypes.bool,
focusOnMount: PropTypes.bool,
shouldCloseOnEsc: PropTypes.bool,
@@ -72,7 +68,6 @@ Modal.defaultProps = {
shouldCloseOnEsc: true,
shouldCloseOnClickOutside: true,
isDismissible: true,
displayTitle: true,
fullScreen: false,
};