import React, { PropTypes, findDOMNode } from 'react' import linkState from 'boost/linkState' import { sendEmail } from 'boost/api' export default class ContactModal extends React.Component { constructor (props) { super(props) this.linkState = linkState this.state = { isSent: false, mail: { title: '', content: '' } } } onKeyCast (e) { switch (e.status) { case 'closeModal': this.props.close() break case 'submitContactModal': if (this.state.isSent) { this.props.close() return } this.sendEmail() break } } componentDidMount () { findDOMNode(this.refs.title).focus() } sendEmail () { sendEmail(this.state.mail) .then(function (res) { this.setState({isSent: !this.state.isSent}) }.bind(this)) .catch(function (err) { console.error(err) }) } render () { return (

Contact form

{!this.state.isSent ? (