|
| 1 | +/* |
| 2 | +Copyright 2015 OpenMarket Ltd |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +'use strict'; |
| 18 | + |
| 19 | +var React = require('react'); |
| 20 | +var classNames = require('classnames'); |
| 21 | + |
| 22 | +var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); |
| 23 | + |
| 24 | +var sdk = require('matrix-react-sdk') |
| 25 | +var dis = require('matrix-react-sdk/lib/dispatcher'); |
| 26 | + |
| 27 | +module.exports = React.createClass({ |
| 28 | + displayName: 'RoomTooltip', |
| 29 | + |
| 30 | + componentDidMount: function() { |
| 31 | + // tell the roomlist about us |
| 32 | + dis.dispatch({ |
| 33 | + action: 'view_tooltip', |
| 34 | + tooltip: this.getDOMNode(), |
| 35 | + }); |
| 36 | + }, |
| 37 | + |
| 38 | + componentDidUnmount: function() { |
| 39 | + dis.dispatch({ |
| 40 | + action: 'view_tooltip', |
| 41 | + tooltip: null, |
| 42 | + }); |
| 43 | + }, |
| 44 | + |
| 45 | + render: function() { |
| 46 | + return ( |
| 47 | + <div className="mx_RoomTooltip"> |
| 48 | + <img className="mx_RoomTooltip_chevron" src="img/chevron-left.png" width="9" height="16"/> |
| 49 | + { this.props.room.name } |
| 50 | + </div> |
| 51 | + ); |
| 52 | + } |
| 53 | +}); |
0 commit comments