mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
switch from enums to string literals for SearchBar.Scope
This commit is contained in:
parent
6aad99a505
commit
ddbc8dffb3
@ -23,23 +23,18 @@ var sdk = require('matrix-react-sdk');
|
|||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'SearchBar',
|
displayName: 'SearchBar',
|
||||||
|
|
||||||
Scope : {
|
|
||||||
Room: 'Room',
|
|
||||||
All: 'All',
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return ({
|
return ({
|
||||||
scope: this.Scope.Room
|
scope: 'Room'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onThisRoomClick: function() {
|
onThisRoomClick: function() {
|
||||||
this.setState({ scope: this.Scope.Room });
|
this.setState({ scope: 'Room' });
|
||||||
},
|
},
|
||||||
|
|
||||||
onAllRoomsClick: function() {
|
onAllRoomsClick: function() {
|
||||||
this.setState({ scope: this.Scope.All });
|
this.setState({ scope: 'All' });
|
||||||
},
|
},
|
||||||
|
|
||||||
onSearchChange: function(e) {
|
onSearchChange: function(e) {
|
||||||
@ -52,8 +47,8 @@ module.exports = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className="mx_SearchBar">
|
<div className="mx_SearchBar">
|
||||||
<input ref="search_term" className="mx_SearchBar_input" type="text" autoFocus={true} placeholder="Search..." onKeyDown={this.onSearchChange}/>
|
<input ref="search_term" className="mx_SearchBar_input" type="text" autoFocus={true} placeholder="Search..." onKeyDown={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 !== '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 !== '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} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user