Skip to content

Instantly share code, notes, and snippets.

@narqo
Created August 20, 2016 11:07
Show Gist options
  • Save narqo/59a091b7a0ec04f09b9ee5346c7f5671 to your computer and use it in GitHub Desktop.
Save narqo/59a091b7a0ec04f09b9ee5346c7f5671 to your computer and use it in GitHub Desktop.
import Popup from 'popup';
class Tooltip extends Component {
render() {
return (
<Popup visible={this.props.visible} anchor={this.props.anchor} onRequestHide={this.onPopupRequestHide}>
<div onMouseEnter={this.onPopupMouseEnter} onMouseLeave={this.onPopupMouseLeave}>
{this.props.children}
</div>
</Popup>
);
}
onPopupMouseEnter() {
this.stopTimer();
}
onPopupMouseLeave() {
this.startTimer();
}
onPopupRequestHide() {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment