import { useState } from "react";
import "../styles/tooltip.scss";
import { InfoCircle, Clock } from "react-bootstrap-icons";

function Tooltip(props) {
  const [show, setShow] = useState(false);
  const { text, iconStyle } = props;
  const showClock = iconStyle === "clock";
  return (
    <div
      className="tooltip-container"
      onMouseEnter={() => setShow(true)}
      onMouseLeave={() => setShow(false)}
    >
      {showClock ? (
        <Clock className="infocircle-icon" size="16px" />
      ) : (
        <InfoCircle className="infocircle-icon" size="16px" />
      )}

      {show ? <span className="tooltip-text">{text}</span> : <></>}
    </div>
  );
}

export default Tooltip;
