2017-08-10 01:56:27 +00:00
|
|
|
import React, {PureComponent} from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-07-16 02:06:10 +00:00
|
|
|
import classnames from 'classnames';
|
2016-04-15 05:23:54 +00:00
|
|
|
|
2017-02-28 21:32:23 +00:00
|
|
|
class ModalHeader extends PureComponent {
|
|
|
|
render () {
|
|
|
|
const {hideCloseButton, className, children} = this.props;
|
|
|
|
let closeButton = null;
|
2016-07-20 18:35:08 +00:00
|
|
|
|
2017-02-28 21:32:23 +00:00
|
|
|
if (!hideCloseButton) {
|
|
|
|
closeButton = (
|
|
|
|
<button type="button" className="btn btn--compact modal__close-btn" data-close-modal="true">
|
2017-03-03 01:44:07 +00:00
|
|
|
<i className="fa fa-times"/>
|
2017-02-28 21:32:23 +00:00
|
|
|
</button>
|
2017-03-03 20:09:08 +00:00
|
|
|
);
|
2017-02-28 21:32:23 +00:00
|
|
|
}
|
2016-07-20 18:35:08 +00:00
|
|
|
|
2017-02-28 21:32:23 +00:00
|
|
|
return (
|
|
|
|
<div className={classnames('modal__header', className)}>
|
|
|
|
<div className="modal__header__children">
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
{closeButton}
|
2016-11-29 20:55:31 +00:00
|
|
|
</div>
|
2017-02-28 21:32:23 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-07-20 18:35:08 +00:00
|
|
|
|
|
|
|
ModalHeader.propTypes = {
|
2017-03-08 05:52:17 +00:00
|
|
|
// Required
|
|
|
|
children: PropTypes.node.isRequired,
|
|
|
|
|
|
|
|
// Optional
|
|
|
|
hideCloseButton: PropTypes.bool,
|
|
|
|
className: PropTypes.string
|
2016-07-20 18:35:08 +00:00
|
|
|
};
|
2016-04-15 05:23:54 +00:00
|
|
|
|
|
|
|
export default ModalHeader;
|