2016-10-27 16:14:30 +00:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
|
2016-12-22 19:26:18 +00:00
|
|
|
import Icon from 'components/icons/Icon';
|
2016-12-21 18:22:18 +00:00
|
|
|
|
2016-10-27 16:14:30 +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>
|
2016-10-27 16:14:30 +00:00
|
|
|
</div>
|
|
|
|
<div className={`${baseClass}__content`}>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-03 19:40:54 +00:00
|
|
|
export default Modal;
|