insomnia/app/ui/components/base/modal-header.js

39 lines
892 B
JavaScript
Raw Normal View History

2017-08-10 01:56:27 +00:00
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
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 = {
// 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;