1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 17:54:53 +01:00
market/src/components/atoms/Tooltip.tsx
2020-06-02 12:15:21 +03:00

25 lines
509 B
TypeScript

import React, { ReactElement, forwardRef } from 'react'
import Tippy from '@tippyjs/react'
export default function Tooltip({
content,
children
}: {
content: string
children: ReactElement
}) {
return (
<Tippy content={content}>
<CustomWrapper>{children}</CustomWrapper>
</Tippy>
)
}
// Forward ref for Tippy.js
// eslint-disable-next-line
const CustomWrapper = forwardRef(
({ children }: { children: ReactElement }, ref: any) => {
return <div ref={ref}>{children}</div>
}
)