aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/objects/LinkPopover.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/objects/LinkPopover.js')
-rw-r--r--frontend/src/components/objects/LinkPopover.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/frontend/src/components/objects/LinkPopover.js b/frontend/src/components/objects/LinkPopover.js
new file mode 100644
index 0000000..58b2f6a
--- /dev/null
+++ b/frontend/src/components/objects/LinkPopover.js
@@ -0,0 +1,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" 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;