2017-08-07 15:31:24 +08:00
|
|
|
import React, { Component } from "react";
|
2017-08-07 19:51:22 +08:00
|
|
|
import { NavDropdown, FormControl } from "react-bootstrap";
|
2017-08-07 15:31:24 +08:00
|
|
|
|
|
|
|
class SearchDropdown extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = { searchTerm: "" };
|
|
|
|
this.handleSearchTermChange = this.handleSearchTermChange.bind(this);
|
2017-08-07 19:51:22 +08:00
|
|
|
this.handleSelect = this.handleSelect.bind(this);
|
2017-08-07 15:31:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
handleSearchTermChange(ev) {
|
|
|
|
ev.preventDefault();
|
2017-08-07 19:51:22 +08:00
|
|
|
console.log("change");
|
2017-08-07 15:31:24 +08:00
|
|
|
this.setState({ searchTerm: ev.target.value });
|
|
|
|
}
|
|
|
|
|
2017-08-07 19:51:22 +08:00
|
|
|
handleSelect(ev) {
|
|
|
|
console.log(ev);
|
|
|
|
ev.preventDefault();
|
2017-08-07 15:31:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-08-07 17:13:09 +08:00
|
|
|
<NavDropdown
|
|
|
|
noCaret
|
|
|
|
title={<span className="glyphicon glyphicon-search" />}
|
2017-08-07 19:51:22 +08:00
|
|
|
id="search-dropdown"
|
2017-08-07 15:31:24 +08:00
|
|
|
>
|
2017-08-07 19:51:22 +08:00
|
|
|
<li role="presentation" onClick={ev => ev.preventDefault()}>
|
|
|
|
<FormControl
|
|
|
|
ref={c => { this.input = c; }}
|
|
|
|
type="text"
|
|
|
|
placeholder="Search"
|
|
|
|
onChange={this.handleSearchTermChange}
|
|
|
|
value={this.state.searchTerm} />
|
|
|
|
</li>
|
2017-08-07 17:13:09 +08:00
|
|
|
</NavDropdown>
|
2017-08-07 15:31:24 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SearchDropdown;
|