aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/objects/LinkPopover.js
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-09-30 20:58:05 +0000
committerEmiliano Ciavatta2020-09-30 20:58:05 +0000
commit55afd62a8cfe2cde6e627f1905ab8fe77965afd6 (patch)
tree57545a722a62d2279bfcd2e36f1cbd1da5a5736a /frontend/src/components/objects/LinkPopover.js
parent4cfdf6e2dfe9184e988a145495e072571d512cdc (diff)
parentd6e2aaad41f916c2080c59cf7b4e42bf87a1a03f (diff)
Merge branch 'feature/frontend' into develop
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..8768caa
--- /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", "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;