You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
5 years ago
|
import React, {Component} from "react";
|
||
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||
|
import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons';
|
||
|
|
||
|
|
||
|
class HelpButton extends Component {
|
||
|
constructor(props) {
|
||
|
super(props);
|
||
|
|
||
5 years ago
|
|
||
5 years ago
|
this.state = {
|
||
|
tooltipOpen: false
|
||
|
};
|
||
|
}
|
||
|
|
||
5 years ago
|
showTooltip = () => {
|
||
|
console.log("show");
|
||
5 years ago
|
this.setState({
|
||
5 years ago
|
tooltipOpen: true
|
||
5 years ago
|
});
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
5 years ago
|
hideTooltip = () => {
|
||
|
console.log("hide");
|
||
|
this.setState({
|
||
|
tooltipOpen: false
|
||
|
});
|
||
|
};
|
||
5 years ago
|
|
||
5 years ago
|
render() {
|
||
5 years ago
|
return (
|
||
5 years ago
|
<span>
|
||
|
<span>
|
||
|
{this.state.tooltipOpen?<span style={{position:"absolute", zIndex:10, fontSize:"12px", color: "#000",backgroundColor:"#fff",display:"inline-block",borderRadius:"0.25rem",boxShadow:"-5px 0 5px rgba(0,0,0,0.5)",maxWidth:"200px",padding:"10px",marginLeft:"-215px", marginTop:"-25px"}}>
|
||
|
<span style={{ position:"absolute", width: 0,height: 0, borderTop: "10px solid transparent", borderBottom: "10px solid transparent", borderLeft: "10px solid #fff", marginLeft:"190px", marginTop:"15px"}}></span>
|
||
|
{this.props.children}
|
||
|
</span>:<span />}
|
||
|
</span>
|
||
|
<FontAwesomeIcon icon={faQuestionCircle} onMouseOver={this.showTooltip} onMouseOut={this.hideTooltip}/>
|
||
|
</span>
|
||
|
|
||
5 years ago
|
);
|
||
|
}
|
||
|
}
|
||
|
export default HelpButton;
|