stacker.news/components/action-tooltip.js

25 lines
564 B
JavaScript
Raw Normal View History

2021-08-13 21:12:19 +00:00
import { useFormikContext } from 'formik'
2021-07-08 18:43:03 +00:00
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
2021-08-13 21:12:19 +00:00
export default function ActionTooltip ({ children, notForm }) {
// if we're in a form, we want to hide tooltip on submit
let formik
if (!notForm) {
formik = useFormikContext()
}
2021-07-08 18:43:03 +00:00
return (
<OverlayTrigger
placement='bottom'
overlay={
<Tooltip>
1 sat
</Tooltip>
}
trigger={['hover', 'focus']}
2021-08-13 21:12:19 +00:00
show={formik?.isSubmitting ? false : undefined}
2021-07-08 18:43:03 +00:00
>
{children}
</OverlayTrigger>
)
}