Skip to content

Commit

Permalink
[#227] Replace boostrap tooltip by react tooltip.
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan committed Oct 28, 2024
1 parent a708648 commit fccbc3b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
20 changes: 17 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"react-promise-tracker": "^2.1.1",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-tooltip": "^5.28.0",
"redux": "^4.1.0",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.3.0",
Expand Down
33 changes: 16 additions & 17 deletions src/components/HelpIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
"use strict";

import React from "react";
import { OverlayTrigger, Tooltip } from "react-bootstrap";
import { Tooltip } from "react-tooltip";
import PropTypes from "prop-types";
import { FaEnvelope, FaQuestionCircle } from "react-icons/fa";
import { FaCheck } from "react-icons/fa";
import { FaTimes } from "react-icons/fa";
import { FaTasks } from "react-icons/fa";
import { FaEnvelope, FaQuestionCircle, FaCheck, FaTimes, FaTasks } from "react-icons/fa";

const HelpIcon = (props) => {
const tooltip = <Tooltip id="help-tooltip">{props.text}</Tooltip>;

const icon = () => {
switch (props.glyph) {
case "ok":
return <FaCheck className={"ok-icon " + props.className} />;
return <FaCheck className={`ok-icon ${props.className}`} />;
case "remove":
return <FaTimes className={"remove-icon " + props.className} />;
return <FaTimes className={`remove-icon ${props.className}`} />;
case "to-do":
return <FaTasks className={"to-do-icon " + props.className} />;
return <FaTasks className={`to-do-icon ${props.className}`} />;
case "envelope":
return <FaEnvelope className={"publish-icon " + props.className} />;
return <FaEnvelope className={`publish-icon ${props.className}`} />;
default:
return <FaQuestionCircle className={"help-icon " + props.className} />;
return <FaQuestionCircle className={`help-icon ${props.className}`} />;
}
};

return (
<OverlayTrigger placement="right" overlay={tooltip}>
{icon()}
</OverlayTrigger>
<>
<a className={`tooltip-${props.glyph}`} data-tooltip-id={`tooltip-${props.glyph}`} aria-label={props.text}>
{icon()}
</a>

<Tooltip id={`tooltip-${props.glyph}`} place="right">
{props.text}
</Tooltip>
</>
);
};

Expand Down

0 comments on commit fccbc3b

Please sign in to comment.