Skip to content

Commit f280fe3

Browse files
authored
Merge pull request element-hq#5540 from vector-im/luke/group-rooms-tooltip
Implement general-purpose tooltip "(?)"-style
2 parents 9ff1fe8 + 4c0e956 commit f280fe3

3 files changed

Lines changed: 61 additions & 2 deletions

File tree

‎src/components/views/rooms/RoomTooltip.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ limitations under the License.
1919
var React = require('react');
2020
var ReactDOM = require('react-dom');
2121
var dis = require('matrix-react-sdk/lib/dispatcher');
22+
import classNames from 'classnames';
2223

2324
module.exports = React.createClass({
2425
displayName: 'RoomTooltip',
2526

2627
propTypes: {
27-
// Alllow the tooltip to be styled by the parent element
28+
// Class applied to the element used to position the tooltip
2829
className: React.PropTypes.string.isRequired,
30+
// Class applied to the tooltip itself
31+
tooltipClassName: React.PropTypes.string,
2932
// The tooltip is derived from either the room name or a label
3033
room: React.PropTypes.object,
3134
label: React.PropTypes.string,
@@ -69,8 +72,12 @@ module.exports = React.createClass({
6972
style.left = 6 + parent.getBoundingClientRect().right + window.pageXOffset;
7073
style.display = "block";
7174

75+
const tooltipClasses = classNames(
76+
"mx_RoomTooltip", this.props.tooltipClassName,
77+
);
78+
7279
var tooltip = (
73-
<div className="mx_RoomTooltip" style={style} >
80+
<div className={tooltipClasses} style={style} >
7481
<div className="mx_RoomTooltip_chevron"></div>
7582
{ label }
7683
</div>

‎src/skins/vector/css/_components.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@import "./matrix-react-sdk/views/elements/_ProgressBar.scss";
3636
@import "./matrix-react-sdk/views/elements/_RichText.scss";
3737
@import "./matrix-react-sdk/views/elements/_RoleButton.scss";
38+
@import "./matrix-react-sdk/views/elements/_ToolTipButton.scss";
3839
@import "./matrix-react-sdk/views/groups/_GroupRoomList.scss";
3940
@import "./matrix-react-sdk/views/login/_InteractiveAuthEntryComponents.scss";
4041
@import "./matrix-react-sdk/views/login/_ServerConfig.scss";
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Copyright 2017 New Vector 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+
.mx_ToolTipButton {
18+
display: inline-block;
19+
width: 11px;
20+
height: 11px;
21+
margin-left: 5px;
22+
23+
border: 2px solid $neutral-badge-color;
24+
border-radius: 20px;
25+
color: $neutral-badge-color;
26+
27+
transition: opacity 0.2s ease-in;
28+
opacity: 0.6;
29+
30+
line-height: 11px;
31+
text-align: center;
32+
33+
cursor: pointer;
34+
}
35+
36+
.mx_ToolTipButton:hover {
37+
opacity: 1.0;
38+
}
39+
40+
.mx_ToolTipButton_container {
41+
position: relative;
42+
top: -18px;
43+
left: 4px;
44+
}
45+
46+
.mx_ToolTipButton_helpText {
47+
width: 200px;
48+
text-align: center;
49+
line-height: 17px !important;
50+
}
51+

0 commit comments

Comments
 (0)