2015-12-21 17:11:34 +03:00
|
|
|
/*
|
2016-01-07 07:06:39 +03:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2015-12-21 17:11:34 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react');
|
|
|
|
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
2016-01-14 19:29:41 +03:00
|
|
|
var CommandEntry = require("../../../TabCompleteEntries").CommandEntry;
|
2015-12-21 17:11:34 +03:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: 'TabCompleteBar',
|
|
|
|
|
2015-12-21 17:34:25 +03:00
|
|
|
propTypes: {
|
2016-07-15 18:10:27 +03:00
|
|
|
tabComplete: React.PropTypes.object.isRequired
|
2015-12-21 17:34:25 +03:00
|
|
|
},
|
|
|
|
|
2015-12-21 17:11:34 +03:00
|
|
|
render: function() {
|
|
|
|
return (
|
2015-12-22 03:47:04 +03:00
|
|
|
<div className="mx_TabCompleteBar">
|
2016-07-15 18:10:27 +03:00
|
|
|
{this.props.tabComplete.peek(6).map((entry, i) => {
|
2015-12-21 17:34:25 +03:00
|
|
|
return (
|
2016-01-14 19:29:41 +03:00
|
|
|
<div key={entry.getKey() || i + ""}
|
2016-07-15 18:10:27 +03:00
|
|
|
className={ "mx_TabCompleteBar_item " + (entry instanceof CommandEntry ? "mx_TabCompleteBar_command" : "") }
|
|
|
|
onClick={this.props.tabComplete.onEntryClick.bind(this.props.tabComplete, entry)} >
|
2015-12-22 13:00:30 +03:00
|
|
|
{entry.getImageJsx()}
|
2015-12-22 03:47:04 +03:00
|
|
|
<span className="mx_TabCompleteBar_text">
|
2015-12-22 14:14:36 +03:00
|
|
|
{entry.getText()}
|
2015-12-22 03:47:04 +03:00
|
|
|
</span>
|
2015-12-21 20:28:04 +03:00
|
|
|
</div>
|
2015-12-21 17:34:25 +03:00
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
2015-12-21 17:11:34 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|