diff --git a/res/css/_components.scss b/res/css/_components.scss
index 60f749de9c..07e92bdc7b 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -148,6 +148,7 @@
@import "./views/rooms/_AuxPanel.scss";
@import "./views/rooms/_BasicMessageComposer.scss";
@import "./views/rooms/_E2EIcon.scss";
+@import "./views/rooms/_InviteOnlyIcon.scss";
@import "./views/rooms/_EditMessageComposer.scss";
@import "./views/rooms/_EntityTile.scss";
@import "./views/rooms/_EventTile.scss";
diff --git a/res/css/views/rooms/_InviteOnlyIcon.scss b/res/css/views/rooms/_InviteOnlyIcon.scss
new file mode 100644
index 0000000000..e70586bb73
--- /dev/null
+++ b/res/css/views/rooms/_InviteOnlyIcon.scss
@@ -0,0 +1,38 @@
+/*
+Copyright 2020 The Matrix.org Foundation C.I.C.
+
+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.
+*/
+
+.mx_InviteOnlyIcon {
+ width: 12px;
+ height: 12px;
+ position: relative;
+ display: block !important;
+ // Align the padlock with unencrypted room names
+ margin-left: 6px;
+
+ &::before {
+ background-color: $roomtile-name-color;
+ mask-image: url('$(res)/img/feather-customised/lock-solid.svg');
+ mask-position: center;
+ mask-repeat: no-repeat;
+ mask-size: contain;
+ content: '';
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ }
+}
diff --git a/res/css/views/rooms/_RoomHeader.scss b/res/css/views/rooms/_RoomHeader.scss
index 6bfcd437c1..0ac2e99b97 100644
--- a/res/css/views/rooms/_RoomHeader.scss
+++ b/res/css/views/rooms/_RoomHeader.scss
@@ -269,24 +269,3 @@ limitations under the License.
.mx_RoomHeader_pinsIndicatorUnread {
background-color: $pinned-unread-color;
}
-
-.mx_RoomHeader_PrivateIcon.mx_RoomHeader_isPrivate {
- width: 12px;
- height: 12px;
- position: relative;
- display: block !important;
-
- &::before {
- background-color: $roomtile-name-color;
- mask-image: url('$(res)/img/feather-customised/lock-solid.svg');
- mask-position: center;
- mask-repeat: no-repeat;
- mask-size: contain;
- content: '';
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
-}
diff --git a/res/css/views/rooms/_RoomTile.scss b/res/css/views/rooms/_RoomTile.scss
index 376f4370e3..a24fdf2629 100644
--- a/res/css/views/rooms/_RoomTile.scss
+++ b/res/css/views/rooms/_RoomTile.scss
@@ -215,30 +215,7 @@ limitations under the License.
flex: 1;
}
-.mx_RoomTile.mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_name {
+.mx_InviteOnlyIcon + .mx_RoomTile_nameContainer .mx_RoomTile_name {
// Scoot the padding in a bit from 6px to make it look better
padding-left: 3px;
}
-
-.mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_PrivateIcon {
- width: 12px;
- height: 12px;
- position: relative;
- display: block !important;
- // Align the padlock with unencrypted room names
- margin-left: 6px;
-
- &::before {
- background-color: $roomtile-name-color;
- mask-image: url('$(res)/img/feather-customised/lock-solid.svg');
- mask-position: center;
- mask-repeat: no-repeat;
- mask-size: contain;
- content: '';
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
-}
diff --git a/src/components/views/rooms/InviteOnlyIcon.js b/src/components/views/rooms/InviteOnlyIcon.js
new file mode 100644
index 0000000000..5afaa7f0f2
--- /dev/null
+++ b/src/components/views/rooms/InviteOnlyIcon.js
@@ -0,0 +1,51 @@
+/*
+Copyright 2020 The Matrix.org Foundation C.I.C.
+
+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.
+*/
+
+import React from 'react';
+import { _t } from '../../../languageHandler';
+import * as sdk from '../../../index';
+
+export default class InviteOnlyIcon extends React.Component {
+ constructor() {
+ super();
+
+ this.state = {
+ hover: false,
+ };
+ }
+
+ onHoverStart = () => {
+ this.setState({hover: true});
+ };
+
+ onHoverEnd = () => {
+ this.setState({hover: false});
+ };
+
+ render() {
+ const Tooltip = sdk.getComponent("elements.Tooltip");
+ let tooltip;
+ if (this.state.hover) {
+ tooltip =