Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltips to convey status icon meaning #284

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/components/chat/UserStatusIcons.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';

import { OverlayTrigger, Tooltip } from 'react-bootstrap';

import FaCircle from 'react-icons/lib/fa/circle';
import FaMinusCircle from 'react-icons/lib/fa/minus-circle';
import FaPencilSquare from 'react-icons/lib/fa/pencil-square';

const activeTooltip = <Tooltip>Active</Tooltip>;

const idleTooltip = <Tooltip>Idle</Tooltip>;

export const UserStatusIcon = ({
username,
status,
Expand All @@ -13,9 +19,27 @@ export const UserStatusIcon = ({
}) => {
let statusIcon = <FaMinusCircle style={styleOffline} />;
if (status === 'viewing') {
statusIcon = <FaCircle style={styleViewing} />;
statusIcon = (
<OverlayTrigger
placement="right"
overlay={activeTooltip}
trigger="hover"
delayShow={300}
delayHide={150}>
<FaCircle style={styleViewing} />
</OverlayTrigger>
);
} else if (status === 'online') {
statusIcon = <FaCircle style={styleOnline} />;
statusIcon = (
<OverlayTrigger
placement="right"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is top any better?

overlay={idleTooltip}
trigger="hover"
delayShow={300}
delayHide={150}>
<FaCircle style={styleOnline} />
</OverlayTrigger>
);
}
return (
<div style={styleUserStatus}>
Expand Down