Skip to content

Commit

Permalink
ui(style): fix tooltip for jars on main view
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni committed Oct 12, 2023
1 parent 86dc327 commit 9163206
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/components/jars/Jar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useRef, useMemo } from 'react'
import { useState, useMemo } from 'react'
import * as rb from 'react-bootstrap'
import classnamesBind from 'classnames/bind'
import { useSettings } from '../../context/SettingsContext'
Expand Down Expand Up @@ -192,37 +192,28 @@ const OpenableJar = ({
onClick,
}: JarProps & TooltipJarProps) => {
const [jarIsOpen, setJarIsOpen] = useState(false)

const tooltipTarget = useRef(null)
const onMouseOver = () => setJarIsOpen(true)
const onMouseOut = () => setJarIsOpen(false)

return (
<div
ref={tooltipTarget}
className={styles.tooltipJarContainer}
onMouseOver={onMouseOver}
onMouseOut={onMouseOut}
onClick={onClick}
>
<rb.Overlay
target={tooltipTarget.current}
show={jarIsOpen}
placement="top"
<div onMouseOver={onMouseOver} onMouseOut={onMouseOut}>
<rb.OverlayTrigger
popperConfig={{
modifiers: [
{
name: 'offset',
options: {
offset: [0, 5],
offset: [0, 10],
},
},
],
}}
overlay={(props) => <rb.Tooltip {...props}>{tooltipText}</rb.Tooltip>}
>
{(props) => <rb.Tooltip {...props}>{tooltipText}</rb.Tooltip>}
</rb.Overlay>
<Jar index={index} balance={balance} frozenBalance={frozenBalance} fillLevel={fillLevel} isOpen={jarIsOpen} />
<div className={styles.tooltipJarContainer} onClick={onClick}>
<Jar index={index} balance={balance} frozenBalance={frozenBalance} fillLevel={fillLevel} isOpen={jarIsOpen} />
</div>
</rb.OverlayTrigger>
</div>
)
}
Expand Down

0 comments on commit 9163206

Please sign in to comment.