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

37 lines
899 B
JavaScript
Raw Normal View History

2018-06-25 17:42:50 +00:00
import React, { PureComponent } from 'react';
2017-08-10 01:56:27 +00:00
import PropTypes from 'prop-types';
import classnames from 'classnames';
2016-04-15 05:23:54 +00:00
class ModalHeader extends PureComponent {
2018-06-25 17:42:50 +00:00
render() {
const { hideCloseButton, className, children } = this.props;
let closeButton = null;
2016-07-20 18:35:08 +00:00
if (!hideCloseButton) {
closeButton = (
2018-10-17 16:42:33 +00:00
<button type="button" className="btn btn--compact modal__close-btn" data-close-modal="true">
2018-06-25 17:42:50 +00:00
<i className="fa fa-times" />
</button>
);
}
2016-07-20 18:35:08 +00:00
return (
2018-10-17 16:42:33 +00:00
<div className={classnames('modal__header theme--dialog__header', className)}>
2018-06-25 17:42:50 +00:00
<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;