21 lines
493 B
JavaScript
21 lines
493 B
JavaScript
import { classes } from 'common/react';
|
|
|
|
export const Tooltip = props => {
|
|
const {
|
|
content,
|
|
position = 'bottom',
|
|
} = props;
|
|
// Empirically calculated length of the string,
|
|
// at which tooltip text starts to overflow.
|
|
const long = typeof content === 'string' && content.length > 35;
|
|
return (
|
|
<div
|
|
className={classes([
|
|
'Tooltip',
|
|
long && 'Tooltip--long',
|
|
position && 'Tooltip--' + position,
|
|
])}
|
|
data-tooltip={content} />
|
|
);
|
|
};
|