insomnia/app/ui/components/base/ModalHeader.js

33 lines
768 B
JavaScript
Raw Normal View History

import React, {PropTypes, PureComponent} from 'react';
import classnames from 'classnames';
2016-04-15 05:23:54 +00:00
class ModalHeader extends PureComponent {
render () {
const {hideCloseButton, className, children} = this.props;
let closeButton = null;
2016-07-20 18:35:08 +00:00
if (!hideCloseButton) {
closeButton = (
<button type="button" className="btn btn--compact modal__close-btn" data-close-modal="true">
<i className="fa fa-times"/>
</button>
);
}
2016-07-20 18:35:08 +00:00
return (
<div className={classnames('modal__header', className)}>
<div className="modal__header__children">
{children}
</div>
{closeButton}
</div>
);
}
}
2016-07-20 18:35:08 +00:00
ModalHeader.propTypes = {
hideCloseButton: PropTypes.bool
};
2016-04-15 05:23:54 +00:00
export default ModalHeader;