import React, { Component } from 'react';
import './tooltip.css';
import { InfoIcon } from './icons';
import Markdown from 'markdown-to-jsx';
interface TooltipProps {
text: string;
}
interface TooltipState {
active: boolean;
}
const nonCaptureLingRegex = /\[[^[]+?\]\([^(]+?\)/;
const linkRegex = /\[([^[]+?)\]\(([^(]+?)\)/;
function markdownLinkToAnchor(link: string) {
const m = link.match(linkRegex);
return ({m[1]});
}
function interweave(arr1: any[], arr2: any[]): any[] {
const commonLen = Math.min(arr1.length, arr2.length);
const arr = [];
for(let i=0; i {
constructor(props) {
super(props);
this.state = {
active: false
};
this.toggleVisible = this.toggleVisible.bind(this);
this.handleBlur = this.handleBlur.bind(this);
}
toggleVisible() {
this.setState(state => ({
active: !state.active
}));
}
handleBlur(event) {
if(!event.currentTarget.contains(event.relatedTarget)) {
this.setState({
active: false
});
}
}
render() {
return (
{
this.state.active?
(
)
: null
}
);
}
}
export default Tooltip;