<commit_before>import React, {Component} from 'react';
import {FormGroup, FormControl} from 'react-bootstrap';

class Searchbar extends Component {
  componentWillMount(){
    this.state = {query: "", type: "invoice"}
  }

  handleChange = (event) => {
    this.setState({
      query: event.target.value
    })
  }

  render(){
    return (
      <form className="search-bar">
        <FormGroup>
          <FormControl type="text" value={this.state.query} onChange={this.handleChange}/>
        </FormGroup>
      </form>
    )
  }
}

export default Searchbar;<commit_msg>Finished Statefull styleized Searchbar for homepage<commit_after>import React, {Component} from 'react';
import {FormGroup, FormControl, InputGroup, Button, Glyphicon} from 'react-bootstrap';
import '../../styles/home/Searchbar.css';

/*
  Searchbar Component for Homepage

  internal state: query, option
  onsubmit: calls props.onSubmit with internal state
*/

class Searchbar extends Component {

  componentWillMount(){
    this.state = {
      query: "", 
      option: this.props.options[0]
    }
  }

  handleChange = (event) => {
    this.setState({
      [event.target.id]: event.target.value
    })
  }

  handleSubmit = (event) => {
    event.preventDefault()
    this.props.onSubmit(this.state)
  }

  render(){
    const options = this.props.options.map((option, index) => <option key={index} value={option}>{option}</option>)
    return (
      <form className="search-bar" onSubmit={this.handleSubmit}>
        <FormGroup>
          <InputGroup>
            <FormControl id="query" type="text" value={this.state.query} onChange={this.handleChange}/>
            <FormControl id="option" componentClass="select" 
                value={this.state.type} onChange={this.handleChange}>
              {options}
            </FormControl>
            <InputGroup.Button>
              <Button type="submit"><Glyphicon glyph="search"/></Button>
            </InputGroup.Button>
          </InputGroup>
        </FormGroup>
      </form>
    )
  }
}

export default Searchbar;
{'fraction_non_alphanumeric': 0.14146815751093825, 'fraction_numerical': 0.0004861448711716091, 'mean_word_length': 2.8181818181818183, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 28, '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': '3298238', 'n_tokens_mistral': 602, 'n_tokens_neox': 596, 'n_words': 126}