// @flow

import React, { PropTypes, Component } from "react";
import type { Children } from "react";
import classnames from "classnames";
import Transition from "react-transition-group/Transition";
import "./Modal.css";

type ModalProps = {
  status: string,
  children?: Children,
  handleClose: () => any
};

export class Modal extends Component {
  props: ModalProps;

  constructor(props: ModalProps) {
    super(props);
    const self: any = this;
    self.onClick = this.onClick.bind(this);
  }

  onClick(e: SyntheticEvent) {
    e.stopPropagation();
  }

  render() {
    const { status } = this.props;

    return (
      <div
        className= "modal-wrapper"
        onClick= {this.props.handleClose}
      >
        <div
          className= {classnames("modal", status)}
          onClick= {this.onClick}
        >
          {this.props.children}
        </div>
      </div>
    );
  }
}

Modal.displayName = "Modal";
Modal.contextTypes = {
  shortcuts: PropTypes.object
};

type SlideProps = {
  in: boolean,
  children?: Children,
  handleClose: () => any
};

export default function Slide({
  in: inProp,
  children,
  handleClose
}: SlideProps) {
  return Transition({
    in: inProp,
    timeout: 175,
    appear: true,
    children: status => {
      return Modal({ status, handleClose }, children);
    }
  });
}

@@ -1168,16 +1168,23 @@
  return 
+(%0A    %3C
 Transiti
@@ -1189,38 +1189,28 @@
 tion
-(%7B%0A   
  in
-: 
+=%7B
 inProp
-,%0A   
+%7D
  timeout
 : 17
@@ -1209,87 +1209,62 @@
 eout
-: 175,%0A   
+=%7B175%7D
  appear
-: true,%0A    children: status =%3E %7B%0A      return 
+%3E%0A      %7Bstatus =%3E %3C
 Modal
-(%7B
  status
-,
+=%7Bstatus%7D
  han
@@ -1275,32 +1275,63 @@
 lose
- %7D, children);%0A    %7D
+=%7BhandleClose%7D%3E%7Bchildren%7D%3C/Modal%3E%7D%0A    %3C/Transition%3E
 %0A  
-%7D
 );%0A%7D

convert Slide to JSX