content: import React from 'react';
  import Geosuggest from 'react-geosuggest';
  
  export default React.createClass({
    componentDidMount() {
      $('.ui.dropdown').dropdown();
    },
  
    componentDidUpdate() {
      $('.ui.dropdown').dropdown('refresh');
    },
    
    handleSubmitAddress(val) {
      console.log(val);
      this.props.onSubmit(this.props.searchBy, val);
    },
  
    handleSubmit(e) {
      e.preventDefault();
  
      this.props.onSubmit(this.props.searchBy, this.refs.defaultInput.value);
    },
  
    handleChangeSearchBy(val) {
      return () => {
        console.log(val);
        this.props.changeSearchBy(val);
      }
    },
  
    renderInput() {
      console.log(this.props.searchBy);
  
      switch (this.props.searchBy) {
      case 'address':
        return <Geosuggest ref="addressInput" className="action input" onSuggestSelect={this.handleSubmitAddress} country="us" placeholder="Search by location..." autoActivateFirstSuggest={true} />;
        break;
      case 'name':
        return <input className="ui input" ref="defaultInput" placeholder="Search by name..." onSubmit={this.handleSubmit}/>;
        break;
      case 'state':
        return <input className="ui input" ref="defaultInput" placeholder="PA, OH, TX..." onSubmit={this.handleSubmit}/>;
        break;
      default:
        return <input className="ui disabled input" value="Whoops, there was a problem..."/>;
      }
    },
    
    render() {
      return (
  	<form id={this.props.id} className="ui large action input" onSubmit={this.handleSubmit}>
  	{this.renderInput()}
  	<div className="ui compact selection dropdown">
  	<div className="text">{this.props.searchBy}</div>
  	<i className="dropdown icon"></i>
  	<div className="menu">
  	<div className="item" onClick={this.handleChangeSearchBy('address')}>address</div>
  	<div className="item" onClick={this.handleChangeSearchBy('name')}>name</div>
  	<div className="item" onClick={this.handleChangeSearchBy('state')}>state</div>
        </div>
  	</div>
  	<div type="submit" className="ui button">
  	Submit
        </div>
  	</form>
      );
    },
  });
  