fleet/frontend/components/TooltipWrapper/TooltipWrapper.tsx
Gabriel Hernandez a950e9d095
Feat/update query doc sidepanel (#8214)
* create new components for query side panel

* add reusable icon component that uses svg for icons

* integrate with new osquery_fleet_schema.json data

* update UI to work with osquery_fleet_schema.json

* add remark-gfm to safely support direct urls in markdown

* move fleet ace into markdown component so we can render code with ace editor

* add testing for new query sidebar

* remove incomplete tests for query sidepanel
2022-10-14 17:45:57 +01:00

41 lines
951 B
TypeScript

import classnames from "classnames";
import React from "react";
interface ITooltipWrapperProps {
children: string;
tipContent: string;
position?: "top" | "bottom";
isDelayed?: boolean;
className?: string;
}
const baseClass = "component__tooltip-wrapper";
const TooltipWrapper = ({
children,
tipContent,
position = "bottom",
isDelayed,
className,
}: ITooltipWrapperProps): JSX.Element => {
const classname = classnames(baseClass, className);
const tipClass = isDelayed
? `${baseClass}__tip-text delayed-tip`
: `${baseClass}__tip-text`;
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: tipContent }}
/>
</div>
);
};
export default TooltipWrapper;