grafana/public/app/core/components/Tooltip/Popover.tsx
Tobias Skarhed 8a99fa269d WIP Update tslint (#12922)
* Interface linting rule

* fix: changed model names in store files so that the interface names do not conflict with the model names
2018-08-24 16:48:47 +02:00

35 lines
731 B
TypeScript

import React from 'react';
import withTooltip from './withTooltip';
import { Target } from 'react-popper';
interface PopoverProps {
tooltipSetState: (prevState: object) => void;
}
class Popover extends React.Component<PopoverProps, any> {
constructor(props) {
super(props);
this.toggleTooltip = this.toggleTooltip.bind(this);
}
toggleTooltip() {
const { tooltipSetState } = this.props;
tooltipSetState(prevState => {
return {
...prevState,
show: !prevState.show,
};
});
}
render() {
return (
<Target className="popper__target" onClick={this.toggleTooltip}>
{this.props.children}
</Target>
);
}
}
export default withTooltip(Popover);