2021-04-16 11:55:48 -07:00
|
|
|
import React, { FunctionComponent, ReactNode } from 'react'
|
2021-04-16 11:16:31 -07:00
|
|
|
import Tippy from '@tippyjs/react'
|
|
|
|
import 'tippy.js/animations/scale.css'
|
|
|
|
|
|
|
|
type TooltipProps = {
|
|
|
|
content: ReactNode
|
|
|
|
}
|
|
|
|
|
2021-04-16 11:55:48 -07:00
|
|
|
const Tooltip: FunctionComponent<TooltipProps> = ({ children, content }) => {
|
2021-04-16 11:16:31 -07:00
|
|
|
return (
|
|
|
|
<Tippy
|
|
|
|
animation="scale"
|
2021-04-16 12:07:59 -07:00
|
|
|
appendTo={() => document.body}
|
2021-04-16 11:16:31 -07:00
|
|
|
maxWidth="none"
|
|
|
|
interactive
|
|
|
|
content={
|
|
|
|
<div className="rounded p-3 text-sm bg-th-bkg-3 text-th-fgd-2 outline-none focus:outline-none">
|
|
|
|
{content}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<button className="outline-none focus:outline-none">{children}</button>
|
|
|
|
</Tippy>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Tooltip
|