aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/objects/LinkPopover.js
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-09-29 16:56:00 +0000
committerEmiliano Ciavatta2020-09-29 16:56:00 +0000
commitd994a21a0dfae9ee026e8aa3ccdee6c213c523aa (patch)
treea9d343300d3b9587bdaa664ef9f005ddc9529656 /frontend/src/components/objects/LinkPopover.js
parent7f4cc5d3f3f92338a464853c182b9d6a3ea850eb (diff)
Complete rules page
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;