mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Prepare tooltip for collapsed support
This commit is contained in:
parent
9f0810240f
commit
715dd7e1b6
1 changed files with 28 additions and 0 deletions
|
@ -23,6 +23,7 @@ import classNames from "classnames";
|
||||||
import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
||||||
import AccessibleButton from "../../views/elements/AccessibleButton";
|
import AccessibleButton from "../../views/elements/AccessibleButton";
|
||||||
import RoomAvatar from "../../views/avatars/RoomAvatar";
|
import RoomAvatar from "../../views/avatars/RoomAvatar";
|
||||||
|
import Tooltip from "../../views/elements/Tooltip";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
@ -34,6 +35,7 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
hover: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Finish stub
|
// TODO: Finish stub
|
||||||
|
@ -52,6 +54,22 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
// TODO: Context menu
|
// TODO: Context menu
|
||||||
// TODO: a11y
|
// TODO: a11y
|
||||||
|
|
||||||
|
constructor(props: IProps) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
hover: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private onTileMouseEnter = () => {
|
||||||
|
this.setState({hover: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
private onTileMouseLeave = () => {
|
||||||
|
this.setState({hover: false});
|
||||||
|
};
|
||||||
|
|
||||||
public render(): React.ReactElement {
|
public render(): React.ReactElement {
|
||||||
// TODO: Collapsed state
|
// TODO: Collapsed state
|
||||||
// TODO: Invites
|
// TODO: Invites
|
||||||
|
@ -86,6 +104,13 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
'mx_RoomTile_badgeShown': false,
|
'mx_RoomTile_badgeShown': false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let tooltip = null;
|
||||||
|
if (false) { // isCollapsed
|
||||||
|
if (this.state.hover) {
|
||||||
|
tooltip = <Tooltip className="mx_RoomTile_tooltip" label={this.props.room.name} dir="auto"/>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<RovingTabIndexWrapper inputRef={this.roomTile}>
|
<RovingTabIndexWrapper inputRef={this.roomTile}>
|
||||||
|
@ -95,6 +120,8 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
tabIndex={isActive ? 0 : -1}
|
tabIndex={isActive ? 0 : -1}
|
||||||
inputRef={ref}
|
inputRef={ref}
|
||||||
className={classes}
|
className={classes}
|
||||||
|
onMouseEnter={this.onTileMouseEnter}
|
||||||
|
onMouseLeave={this.onTileMouseLeave}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div className={avatarClasses}>
|
<div className={avatarClasses}>
|
||||||
|
@ -109,6 +136,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{tooltip}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
}
|
}
|
||||||
</RovingTabIndexWrapper>
|
</RovingTabIndexWrapper>
|
||||||
|
|
Loading…
Reference in a new issue