<commit_before>import './SearchBar.styl';
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
import {Input, Button} from 'react-bootstrap';

export default class SearchBar extends Component {

  static propTypes = {
    //tweets: PropTypes.array
  };

  constructor(props) {
    super(props);
    this.state = {
      isButtonDisabled : true,
      currentInputValue: ""
    }
    this.handleInputValueChange = this.handleInputValueChange.bind(this);
  }

  handleInputValueChange(event) {
    if(event.target.value === "") {
      this.setState({isButtonDisabled : true});
    } else {
      this.setState({isButtonDisabled : false});
    }
    console.log(this.state.isButtonDisabled);
    this.setState({currentInputValue : event.target.value})
  }

  render() {
    let input = <Input
      className="input"
      onChange={this.handleInputValueChange}
      placeholder="Type twitter username"
      standalone
      type="text"
      value={this.state.currentInputValue}/>;

    let confirmationButton = <Button
      disabled={this.state.isButtonDisabled}
      bsStyle="primary"
      standalone>
      Show tweets
    </Button>;


    return (
      <div className="search-bar">
        <form>
          {input}
          {confirmationButton}<commit_msg>Searching and showing tweets implemented<commit_after>import './SearchBar.styl';
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
import {Input, Button} from 'react-bootstrap';

export default class SearchBar extends Component {

  static propTypes = {
    onSearchBarButtonClick : PropTypes.func,
    isGUIDisabledDueToLoading : PropTypes.bool
  };

  constructor(props) {
    super(props);
    this.state = {
      currentInputValue : ""
    }
    this._handleInputValueChange = this._handleInputValueChange.bind(this);
    this._onButtonClick = this._onButtonClick.bind(this);
  }


  _handleInputValueChange(event) {
    this.setState({currentInputValue : event.target.value})
  }

  _onButtonClick()
  {
    var currentInputValue = this.state.currentInputValue;
    this.props.onSearchBarButtonClick(currentInputValue);
  }

  render() {
    console.log(this.state.currentInputValue);
    return (
      <div className="search-bar">
        <form>
          <Input
            className="input"
            disabled= {this.props.isGUIDisabledDueToLoading}
            onChange={this._handleInputValueChange}
            placeholder="Type twitter username"
            standalone
            type="text"
            value={this.state.currentInputValue}
          />
          <Button
            disabled={this.state.currentInputValue === "" || this.props.isGUIDisabledDueToLoading}
            bsStyle="primary"
            onClick={this._onButtonClick}
            standalone
          >
            { this.props.isGUIDisabledDueToLoading ? "Loading..." : "Show tweets" }
          </Button>
{'fraction_non_alphanumeric': 0.11299626739056667, 'fraction_numerical': 0.0, 'mean_word_length': 2.848563968668407, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1544728', 'n_tokens_mistral': 833, 'n_tokens_neox': 819, 'n_words': 146}