import React, {Component, PropTypes} from 'react'
import cx from 'classnames'
import ReactModal2 from 'react-modal2'
import ReactGateway from 'react-gateway'

import './modal.scss'

if (typeof window !== 'undefined') {
	ReactModal2.setApplicationElement(document.getElementById('app'))
}

export default class Modal extends Component {
	static propTypes = {
		backdropClassName: PropTypes.string,
		children: PropTypes.node.isRequired,
		modalClassName: PropTypes.string,
		onClose: PropTypes.func.isRequired,
	};

	render() {
		return (
			<ReactGateway>
				<ReactModal2
					onClose={this.props.onClose}
					backdropClassName={cx('modal--backdrop', this.props.backdropClassName)}
					modalClassName={cx('modal--content', this.props.modalClassName)}
				>
					{this.props.children}
				</ReactModal2>
			</ReactGateway>
		)
	}
}

@@ -12,19 +12,8 @@
 t, %7B
-Component, 
 Prop
@@ -290,232 +290,32 @@
 ult 
-class Modal extends Component %7B%0A%09static propTypes = %7B%0A%09%09backdropClassName: PropTypes.string,%0A%09%09children: PropTypes.node.isRequired,%0A%09%09modalClassName: PropTypes.string,%0A%09%09onClose: PropTypes.func.isRequired,%0A%09%7D;%0A%0A%09render(
+function Modal(props
 ) %7B%0A
-%09
 %09ret
@@ -320,17 +320,16 @@
 eturn (%0A
-%09
 %09%09%3CReact
@@ -337,17 +337,16 @@
 ateway%3E%0A
-%09
 %09%09%09%3CReac
@@ -357,17 +357,16 @@
 al2%0A%09%09%09%09
-%09
 onClose=
@@ -366,21 +366,16 @@
 nClose=%7B
-this.
 props.on
@@ -385,17 +385,16 @@
 se%7D%0A%09%09%09%09
-%09
 backdrop
@@ -426,21 +426,16 @@
 kdrop', 
-this.
 props.ba
@@ -452,17 +452,16 @@
 sName)%7D%0A
-%09
 %09%09%09%09moda
@@ -493,21 +493,16 @@
 ntent', 
-this.
 props.mo
@@ -516,17 +516,16 @@
 sName)%7D%0A
-%09
 %09%09%09%3E%0A%09%09%09
@@ -529,15 +529,9 @@
 %09%09%09%09
-%09%7Bthis.
+%7B
 prop
@@ -542,17 +542,16 @@
 ildren%7D%0A
-%09
 %09%09%09%3C/Rea
@@ -562,17 +562,16 @@
 dal2%3E%0A%09%09
-%09
 %3C/ReactG
@@ -583,12 +583,179 @@
 y%3E%0A%09
-%09)%0A%09%7D
+)%0A%7D%0A%0AModal.propTypes = %7B%0A%09backdropClassName: PropTypes.string,%0A%09children: PropTypes.node.isRequired,%0A%09modalClassName: PropTypes.string,%0A%09onClose: PropTypes.func.isRequired,
 %0A%7D%0A

make modal a pure function