insomnia/app/ui/components/base/ModalHeader.js
Gregory Schier b198e6170b React performance sweep (#96)
* Removed some unnecessary rendering

* Only PureComponents and some other stuff

* Removed all functional components

* Only deal with nunjucks marks

* Remove ref assign functions in modals

* Lots of tweaks

* A bit snappier

* A bit snappier
2017-02-28 13:32:23 -08:00

33 lines
770 B
JavaScript

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