insomnia/app/ui/components/base/modal-header.js
Gregory Schier 8452e8b777 Some eslint refactoring (#109)
* Fixed duplication kve bug

* Some changes

* Add proptypes linting

* Fixed proptypes even more

* Filename linting
2017-03-07 21:52:17 -08:00

38 lines
867 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"/>
</button>
);
}
return (
<div className={classnames('modal__header', className)}>
<div className="modal__header__children">
{children}
</div>
{closeButton}
</div>
);
}
}
ModalHeader.propTypes = {
// Required
children: PropTypes.node.isRequired,
// Optional
hideCloseButton: PropTypes.bool,
className: PropTypes.string
};
export default ModalHeader;