fleet/frontend/components/modals/Modal/Modal.jsx

41 lines
1.1 KiB
React
Raw Normal View History

import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import Icon from 'components/icons/Icon';
2016-12-21 18:22:18 +00:00
const baseClass = 'modal';
class Modal extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
onExit: PropTypes.func,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
};
render () {
const { children, className, onExit, title } = this.props;
const modalContainerClassName = classnames(`${baseClass}__modal_container`, className);
return (
<div className={`${baseClass}__background`}>
<div className={modalContainerClassName}>
<div className={`${baseClass}__header`}>
<span>{title}</span>
2016-12-21 18:22:18 +00:00
<div className={`${baseClass}__ex`}>
<button className="button button--unstyled" onClick={onExit}>
<Icon name="x" />
</button>
</div>
</div>
<div className={`${baseClass}__content`}>
{children}
</div>
</div>
</div>
);
}
}
export default Modal;