blob: 8768caa867aa33e82662b3929eb937566d5adddb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import React, {Component} from 'react';
import {randomClassName} from "../../utils";
import {OverlayTrigger, Popover} from "react-bootstrap";
import './LinkPopover.scss';
class LinkPopover extends Component {
constructor(props) {
super(props);
this.id = `link-overlay-${randomClassName()}`;
}
render() {
const popover = (
<Popover id={this.id}>
{this.props.title && <Popover.Title as="h3">{this.props.title}</Popover.Title>}
<Popover.Content>
{this.props.content}
</Popover.Content>
</Popover>
);
return (this.props.content ?
<OverlayTrigger trigger={["hover", "focus"]} placement={this.props.placement || "top"} overlay={popover}>
<span className="link-popover">{this.props.text}</span>
</OverlayTrigger> :
<span className="link-popover-empty">{this.props.text}</span>
);
}
}
export default LinkPopover;
|