📅  最后修改于: 2022-03-11 14:52:52.890000             🧑  作者: Mango
--Tooltip.jsx
import React, { useState } from 'react'
import * as Reactstrap from 'reactstrap'
const Tooltip = props => {
const [tooltipOpen, setTooltipOpen] = useState(false)
const toggle = () => setTooltipOpen(!tooltipOpen)
// Warnings for component useage
if (!props.component) {
console.warn('Missing component for tooltip')
}
if (!props.tooltipContent) {
console.warn('Missing content for tooltip')
}
if (props.component && !props.component.props.id) {
console.warn('Component for tooltip has no id (must not have spaces)')
}
return (
{props.component}
{props.tooltipContent && (
{props.tooltipContent && (
{props.tooltipContent}
)}
)}
)
}
Tooltip.displayName = 'Tooltip'
export default Tooltip