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

View File

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