fleet/frontend/components/TooltipWrapper/TooltipWrapper.tsx
Martavis Parker 33c5f0651c
New tooltips! (#4326)
* Allow sort by more than one key

* created custom tooltip component

* remove unused code

* fixed style for more layouts

* added tooltip to query side panel

* tooltips added to setting form

* finished settings form

* added tooltip for perf impact table headers

* tooltip for pack table and user form

* tooltip on manage policies page

* tooltip for manage schedules

* tooltip for automations; spacing for form input

* tooltip for automations modal

* user form; fixed input with icon component

* more user form tooltips

* tooltip for homepage; style fixes

* replaced many more tooltips with new version

* added story for tooltip

* added position prop

* fixed tests

* re-work how we click react-select dropdowns

* forcing the update button click

* trying a blur

* fixed typo

* trying blur on another element

* temp check-in

* replaced tooltip from host details software

* more consolidation of tooltip use for software

* fixed settings flow test

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2022-02-28 13:25:06 -08:00

31 lines
700 B
TypeScript

import React from "react";
interface ITooltipWrapperProps {
children: string;
tipContent: string;
position?: "top" | "bottom";
}
const baseClass = "component__tooltip-wrapper";
const TooltipWrapper = ({
children,
tipContent,
position = "bottom",
}: ITooltipWrapperProps): JSX.Element => {
return (
<div className={baseClass} data-position={position}>
<div className={`${baseClass}__element`}>
{children}
<div className={`${baseClass}__underline`} data-text={children} />
</div>
<div
className={`${baseClass}__tip-text`}
dangerouslySetInnerHTML={{ __html: tipContent }}
/>
</div>
);
};
export default TooltipWrapper;