From b72ab57e1b33d443b40a56e73645044233a736f5 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 24 Jan 2020 10:13:03 +0000
Subject: [PATCH] add to
---
src/components/views/rooms/E2EIcon.js | 40 +++++++++++++++++++++------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/components/views/rooms/E2EIcon.js b/src/components/views/rooms/E2EIcon.js
index 7ac3b5af2d..df5fe204d4 100644
--- a/src/components/views/rooms/E2EIcon.js
+++ b/src/components/views/rooms/E2EIcon.js
@@ -15,13 +15,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-import React from "react";
+import React, {useState} from "react";
import PropTypes from "prop-types";
import classNames from 'classnames';
import {_t, _td} from '../../../languageHandler';
-import AccessibleButton from '../elements/AccessibleButton';
import {useFeatureEnabled} from "../../../hooks/useSettings";
+import AccessibleButton from "../elements/AccessibleButton";
+import Tooltip from "../elements/Tooltip";
export const E2E_STATE = {
VERIFIED: "verified",
@@ -51,7 +52,9 @@ const legacyRoomTitles = {
};
const E2EIcon = ({isUser, status, className, size, onClick}) => {
- const e2eIconClasses = classNames({
+ const [hover, setHover] = useState(false);
+
+ const classes = classNames({
mx_E2EIcon: true,
mx_E2EIcon_warning: status === E2E_STATE.WARNING,
mx_E2EIcon_normal: status === E2E_STATE.NORMAL,
@@ -70,17 +73,36 @@ const E2EIcon = ({isUser, status, className, size, onClick}) => {
e2eTitle = legacyRoomTitles[status];
}
- let style = null;
+ let style;
if (size) {
style = {width: `${size}px`, height: `${size}px`};
}
- const icon = (
);
- if (onClick) {
- return ({ icon });
- } else {
- return icon;
+ const onMouseOver = () => setHover(true);
+ const onMouseOut = () => setHover(false);
+
+ let tip;
+ if (hover) {
+ tip = ;
}
+
+ if (onClick) {
+ return (
+
+ { tip }
+
+ );
+ }
+
+ return
+ { tip }
+
;
};
E2EIcon.propTypes = {