mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
* Rename index.tsx to {class name}.tsx
* Update tests
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
25 lines
795 B
TypeScript
25 lines
795 B
TypeScript
import { useId } from "@uifabric/react-hooks";
|
|
import { ITooltipHostStyles, TooltipHost } from "office-ui-fabric-react/lib/Tooltip";
|
|
import * as React from "react";
|
|
import InfoBubble from "../../../images/info-bubble.svg";
|
|
|
|
const calloutProps = { gapSpace: 0 };
|
|
const hostStyles: Partial<ITooltipHostStyles> = { root: { display: "inline-block" } };
|
|
|
|
export interface TooltipProps {
|
|
children: string;
|
|
}
|
|
export const Tooltip: React.FunctionComponent = ({ children }: TooltipProps) => {
|
|
const tooltipId = useId("tooltip");
|
|
|
|
return children ? (
|
|
<span>
|
|
<TooltipHost content={children} id={tooltipId} calloutProps={calloutProps} styles={hostStyles}>
|
|
<img className="infoImg" src={InfoBubble} alt="More information" />
|
|
</TooltipHost>
|
|
</span>
|
|
) : (
|
|
<></>
|
|
);
|
|
};
|