mirror of
https://github.com/fleetdm/fleet
synced 2026-05-18 14:38:53 +00:00
relates to #13308 Implements the UI for the activity item for script ran, and the script details modal. NOTE: Still have to do API integration and will do when API is ready in another PR. - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [ ] Added/updated tests - [x] Manual QA for all new/changed functionality
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import classnames from "classnames";
|
|
import React from "react";
|
|
|
|
import * as DOMPurify from "dompurify";
|
|
|
|
interface ITooltipWrapperProps {
|
|
children: string;
|
|
tipContent: string;
|
|
position?: "top" | "bottom";
|
|
isDelayed?: boolean;
|
|
className?: string;
|
|
tooltipClass?: string;
|
|
}
|
|
|
|
const baseClass = "component__tooltip-wrapper";
|
|
|
|
const TooltipWrapper = ({
|
|
children,
|
|
tipContent,
|
|
position = "bottom",
|
|
isDelayed,
|
|
className,
|
|
tooltipClass,
|
|
}: ITooltipWrapperProps): JSX.Element => {
|
|
const classname = classnames(baseClass, className);
|
|
const tipClass = classnames(`${baseClass}__tip-text`, tooltipClass, {
|
|
"delayed-tip": isDelayed,
|
|
});
|
|
|
|
const sanitizedTipContent = DOMPurify.sanitize(tipContent);
|
|
|
|
return (
|
|
<div className={classname} data-position={position}>
|
|
<div className={`${baseClass}__element`}>
|
|
{children}
|
|
<div className={`${baseClass}__underline`} data-text={children} />
|
|
</div>
|
|
<div
|
|
className={tipClass}
|
|
dangerouslySetInnerHTML={{ __html: sanitizedTipContent }}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default TooltipWrapper;
|