19
19
import React , { forwardRef , HTMLProps } from "react" ;
20
20
import { Icon } from "@vector-im/compound-design-tokens/icons/threads-solid.svg" ;
21
21
import classNames from "classnames" ;
22
- import { IndicatorIcon } from "@vector-im/compound-web" ;
22
+ import { IconButton , Text , Tooltip } from "@vector-im/compound-web" ;
23
23
24
24
import { _t } from "../../../../languageHandler" ;
25
- import AccessibleTooltipButton from "../../elements/AccessibleTooltipButton" ;
26
25
import { NotificationLevel } from "../../../../stores/notifications/NotificationLevel" ;
27
- import { notificationLevelToIndicator } from "../../../../utils/notifications" ;
28
26
29
27
interface ThreadsActivityCentreButtonProps extends HTMLProps < HTMLDivElement > {
30
28
/**
@@ -35,35 +33,48 @@ interface ThreadsActivityCentreButtonProps extends HTMLProps<HTMLDivElement> {
35
33
* The notification level of the threads.
36
34
*/
37
35
notificationLevel : NotificationLevel ;
36
+ /**
37
+ * Whether to disable the tooltip.
38
+ */
39
+ disableTooltip ?: boolean ;
38
40
}
39
41
40
42
/**
41
43
* A button to open the thread activity centre.
42
44
*/
43
45
export const ThreadsActivityCentreButton = forwardRef < HTMLDivElement , ThreadsActivityCentreButtonProps > (
44
- function ThreadsActivityCentreButton ( { displayLabel, notificationLevel, ...props } , ref ) : React . JSX . Element {
46
+ function ThreadsActivityCentreButton (
47
+ { displayLabel, notificationLevel, disableTooltip = false , ...props } ,
48
+ ref ,
49
+ ) : React . JSX . Element {
50
+ const openTooltip = displayLabel || disableTooltip ? false : undefined ;
51
+
45
52
return (
46
- < AccessibleTooltipButton
47
- className = { classNames ( "mx_ThreadsActivityCentreButton" , { expanded : displayLabel } ) }
48
- title = { _t ( "common|threads" ) }
49
- // @ts -ignore
50
- // ref nightmare...
51
- ref = { ref }
52
- forceHide = { displayLabel }
53
- aria-expanded = { displayLabel }
54
- // The compound component Menu is already handling the keyboard events
55
- disableKeyboardOverrides = { true }
56
- { ...props }
57
- >
58
- < IndicatorIcon
59
- className = "mx_ThreadsActivityCentreButton_IndicatorIcon"
60
- indicator = { notificationLevelToIndicator ( notificationLevel ) }
61
- size = "24px"
53
+ < Tooltip label = { _t ( "common|threads" ) } side = "right" open = { openTooltip } >
54
+ < IconButton
55
+ className = { classNames ( "mx_ThreadsActivityCentreButton" , { expanded : displayLabel } ) }
56
+ // indicator={notificationLevelToIndicator(notificationLevel)}
57
+ indicator = "critical"
58
+ // @ts -ignore
59
+ // ref nightmare...
60
+ ref = { ref }
61
+ { ...props }
62
62
>
63
- < Icon className = "mx_ThreadsActivityCentreButton_Icon" />
64
- </ IndicatorIcon >
65
- { displayLabel && _t ( "common|threads" ) }
66
- </ AccessibleTooltipButton >
63
+ < >
64
+ < Icon className = "mx_ThreadsActivityCentreButton_Icon" />
65
+ { displayLabel && (
66
+ < Text
67
+ className = "mx_ThreadsActivityCentreButton_Text"
68
+ as = "span"
69
+ size = "md"
70
+ title = { _t ( "common|threads" ) }
71
+ >
72
+ { _t ( "common|threads" ) }
73
+ </ Text >
74
+ ) }
75
+ </ >
76
+ </ IconButton >
77
+ </ Tooltip >
67
78
) ;
68
79
} ,
69
80
) ;
0 commit comments