2020-09-16 10:30:19 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2020-09-16 10:30:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { EuiToolTip } from '@elastic/eui';
|
|
|
|
|
|
|
|
export interface TooltipWrapperProps {
|
|
|
|
tooltipContent: string;
|
|
|
|
condition: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const TooltipWrapper: React.FunctionComponent<TooltipWrapperProps> = ({
|
|
|
|
children,
|
|
|
|
condition,
|
|
|
|
tooltipContent,
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{condition ? (
|
|
|
|
<EuiToolTip content={tooltipContent} delay="long">
|
|
|
|
<>{children}</>
|
|
|
|
</EuiToolTip>
|
|
|
|
) : (
|
|
|
|
children
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|