]> git.somenet.org - pub/jan/aic18.git/blob - service-website/src/components/SearchTermsInput.js
Move components to separate dir, remove example CSS and test
[pub/jan/aic18.git] / service-website / src / components / SearchTermsInput.js
1 import React, {Component} from "react";
2 import PropTypes from "prop-types";
3
4 class SearchTermsInput extends Component {
5     constructor(props, context) {
6         super(props, context);
7         this.handleAddTerm = this.handleAddTerm.bind(this);
8         this.handleChange = this.handleChange.bind(this);
9     }
10
11     handleAddTerm(event) {
12         event.preventDefault();
13         this.props.onAddTerm(event);
14     }
15
16     handleChange(event) {
17
18     }
19
20     render() {
21         const terms = this.props.terms;
22         return (
23             <div className="search-terms-input">
24                 {terms}
25                 <button onClick={this.handleAddTerm}>Add term</button>
26             </div>
27         );
28     }
29 }
30
31 SearchTermsInput.propTypes = {
32     terms: PropTypes.arrayOf(PropTypes.element).isRequired,
33     onAddTerm: PropTypes.func.isRequired,
34 };
35
36 export default SearchTermsInput;