2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2019-06-28 09:27:55 +02:00
|
|
|
import type { Node } from 'react';
|
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
type Props = {
|
2019-06-28 09:27:55 +02:00
|
|
|
label: string | Node,
|
2019-10-17 18:51:16 +02:00
|
|
|
children: Node,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
function Tooltip(props: Props) {
|
|
|
|
const { children, label } = props;
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2019-10-17 18:51:16 +02:00
|
|
|
if (typeof label !== 'string') {
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <span title={label}>{children}</span>;
|
2018-03-26 23:32:43 +02:00
|
|
|
}
|
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
export default Tooltip;
|