import React from "react"; import ReactTooltip from "react-tooltip"; import { uniqueId } from "lodash"; import classnames from "classnames"; import { IconNames } from "components/icons"; import Icon from "components/Icon"; import { COLORS } from "styles/var/colors"; const baseClass = "status-indicator-with-icon"; export type IndicatorStatus = | "success" | "successPartial" | "pending" | "pendingPartial" | "error"; interface IStatusIndicatorWithIconProps { status: IndicatorStatus; value: string; tooltip?: { tooltipText: string | JSX.Element; position?: "top" | "bottom"; }; className?: string; } const statusIconNameMapping: Record = { success: "success", successPartial: "success-partial", pending: "pending", pendingPartial: "pending-partial", error: "error", }; const StatusIndicatorWithIcon = ({ status, value, tooltip, className, }: IStatusIndicatorWithIconProps) => { const classNames = classnames(baseClass, className); const id = `status-${uniqueId()}`; const valueContent = ( {value} ); const indicatorContent = tooltip ? ( <> {valueContent} {tooltip.tooltipText} ) : ( {valueContent} ); return
{indicatorContent}
; }; export default StatusIndicatorWithIcon;