WIP omnipresent join button

This commit is contained in:
David Baker 2016-09-23 15:25:38 +01:00
parent 6281d76ade
commit b1e4c911eb

View file

@ -24,6 +24,7 @@ export default class DirectorySearchBox extends React.Component {
this.onClearClick = this.onClearClick.bind(this); this.onClearClick = this.onClearClick.bind(this);
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
this.onKeyUp = this.onKeyUp.bind(this); this.onKeyUp = this.onKeyUp.bind(this);
this.onJoinButtonClick = this.onJoinButtonClick.bind(this);
this.input = null; this.input = null;
} }
@ -59,12 +60,28 @@ export default class DirectorySearchBox extends React.Component {
} }
} }
onJoinButtonClick() {
}
_contentLooksLikeAlias() {
return true;
}
render() { render() {
const searchbox_classes = { const searchbox_classes = {
mx_DirectorySearchBox: true, mx_DirectorySearchBox: true,
}; };
searchbox_classes[this.props.className] = true; searchbox_classes[this.props.className] = true;
let join_button;
if (this._contentLooksLikeAlias()) {
join_button = <span className="mx_DirectorySearchBox_joinButton"
onClick={this.onJoinButtonClick}
>
Join
</span>;
}
return <span className={classnames(searchbox_classes)}> return <span className={classnames(searchbox_classes)}>
<input type="text" size="64" <input type="text" size="64"
className="mx_DirectorySearchBox_input" className="mx_DirectorySearchBox_input"
@ -72,6 +89,7 @@ export default class DirectorySearchBox extends React.Component {
onChange={this.onChange} onKeyUp={this.onKeyUp} onChange={this.onChange} onKeyUp={this.onKeyUp}
placeholder="Find a room by keyword or room ID (#matrix:matrix.org)" placeholder="Find a room by keyword or room ID (#matrix:matrix.org)"
/> />
{join_button}
<span className="mx_DirectorySearchBox_clear" onClick={this.onClearClick} /> <span className="mx_DirectorySearchBox_clear" onClick={this.onClearClick} />
</span>; </span>;
} }