import React, { Component } from 'react';
import { Button, Card, CardBody, CardHeader, Tooltip, UncontrolledTooltip } from 'reactstrap';
class TooltipItem extends React.Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
tooltipOpen: false,
};
}
toggle() {
this.setState({
tooltipOpen: !this.state.tooltipOpen,
});
}
render() {
return (
Tooltip Content!
);
}
}
class Tooltips extends Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
tooltipOpen: [false, false],
tooltips: [
{
placement: 'top',
text: 'Top',
},
{
placement: 'bottom',
text: 'Bottom',
},
{
placement: 'left',
text: 'Left',
},
{
placement: 'right',
text: 'Right',
},
],
};
}
toggle(i) {
const newArray = this.state.tooltipOpen.map((element, index) => {
return (index === i ? !element : false);
});
this.setState({
tooltipOpen: newArray,
});
}
render() {
return (
Tooltips
{/*eslint-disable-next-line*/}
Somewhere in here is a tooltip.
{this.toggle(0);}}>
Hello world!
Tooltip
disable autohide
{/*eslint-disable-next-line*/}
Sometimes you need to allow users to select text within a tooltip.
{this.toggle(1);}}>
Try to select this text!
Tooltip
list
{this.state.tooltips.map((tooltip, i) => {
return ;
})}
Tooltip
uncontrolled
{/*eslint-disable-next-line*/}
Somewhere in here is a tooltip.
Hello world!
);
}
}
export default Tooltips;