Add tooltips for room buttons

This commit is contained in:
Robert Long 2021-11-24 13:33:32 -08:00
parent f0d5977e88
commit baa7d4869c
2 changed files with 34 additions and 0 deletions

View file

@ -75,6 +75,9 @@ export function DropdownButton({ onChange, options, value, children }) {
export function MicButton({ muted, ...rest }) { export function MicButton({ muted, ...rest }) {
return ( return (
<RoomButton {...rest} on={muted}> <RoomButton {...rest} on={muted}>
<ButtonTooltip>
{muted ? "Unmute microphone" : "Mute microphone"}
</ButtonTooltip>
{muted ? <MuteMicIcon /> : <MicIcon />} {muted ? <MuteMicIcon /> : <MicIcon />}
</RoomButton> </RoomButton>
); );
@ -83,6 +86,9 @@ export function MicButton({ muted, ...rest }) {
export function VideoButton({ enabled, ...rest }) { export function VideoButton({ enabled, ...rest }) {
return ( return (
<RoomButton {...rest} on={enabled}> <RoomButton {...rest} on={enabled}>
<ButtonTooltip>
{enabled ? "Turn off camera" : "Turn on camera"}
</ButtonTooltip>
{enabled ? <DisableVideoIcon /> : <VideoIcon />} {enabled ? <DisableVideoIcon /> : <VideoIcon />}
</RoomButton> </RoomButton>
); );
@ -95,6 +101,9 @@ export function ScreenshareButton({ enabled, className, ...rest }) {
{...rest} {...rest}
on={enabled} on={enabled}
> >
<ButtonTooltip>
{enabled ? "Stop sharing screen" : "Share screen"}
</ButtonTooltip>
<ScreenshareIcon /> <ScreenshareIcon />
</RoomButton> </RoomButton>
); );
@ -106,6 +115,7 @@ export function HangupButton({ className, ...rest }) {
className={classNames(styles.hangupButton, className)} className={classNames(styles.hangupButton, className)}
{...rest} {...rest}
> >
<ButtonTooltip>Leave</ButtonTooltip>
<HangupIcon /> <HangupIcon />
</RoomButton> </RoomButton>
); );
@ -143,3 +153,7 @@ export function LayoutToggleButton({ layout, ...rest }) {
</HeaderButton> </HeaderButton>
); );
} }
export function ButtonTooltip({ children }) {
return <div className={styles.buttonTooltip}>{children}</div>;
}

View file

@ -17,6 +17,7 @@ limitations under the License.
.roomButton, .roomButton,
.headerButton, .headerButton,
.dropdownButton { .dropdownButton {
position: relative;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -117,3 +118,22 @@ limitations under the License.
.dropdownActiveItem { .dropdownActiveItem {
color: #0dbd8b; color: #0dbd8b;
} }
.buttonTooltip {
display: none;
background-color: var(--bgColor2);
position: absolute;
bottom: calc(100% + 6px);
flex-direction: row;
justify-content: center;
align-items: center;
padding: 8px 10px;
color: var(--textColor1);
border-radius: 8px;
max-width: 135px;
width: max-content;
}
.roomButton:hover .buttonTooltip {
display: flex;
}