WIP search stuff

This commit is contained in:
Matthew Hodgson 2015-10-28 19:41:23 +00:00
parent 0bfb1416c1
commit cb095ba5a0

View File

@ -43,13 +43,15 @@ module.exports = React.createClass({
}, },
onSearchChange: function(e) { onSearchChange: function(e) {
if (e.keyCode === 13) {
this.props.onSearch(this.refs.search_term.getDOMNode().value);
}
}, },
render: function() { render: function() {
return ( return (
<div className="mx_SearchBar"> <div className="mx_SearchBar">
<input className="mx_SearchBar_input" type="text" placeholder="Search..." onChange={this.onSearchChange}/> <input ref="search_term" className="mx_SearchBar_input" type="text" placeholder="Search..." onChange={this.onSearchChange}/>
<div className={"mx_SearchBar_button" + (this.state.scope !== this.Scope.Room ? " mx_SearchBar_unselected" : "")} onClick={this.onThisRoomClick}>This Room</div> <div className={"mx_SearchBar_button" + (this.state.scope !== this.Scope.Room ? " mx_SearchBar_unselected" : "")} onClick={this.onThisRoomClick}>This Room</div>
<div className={"mx_SearchBar_button" + (this.state.scope !== this.Scope.All ? " mx_SearchBar_unselected" : "")} onClick={this.onAllRoomsClick}>All Rooms</div> <div className={"mx_SearchBar_button" + (this.state.scope !== this.Scope.All ? " mx_SearchBar_unselected" : "")} onClick={this.onAllRoomsClick}>All Rooms</div>
<img className="mx_SearchBar_cancel" src="img/cancel-black.png" width="18" height="18" onClick={this.props.onCancelClick} /> <img className="mx_SearchBar_cancel" src="img/cancel-black.png" width="18" height="18" onClick={this.props.onCancelClick} />