-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(tooltip): fallback to left/top positioning, add applyPositionStyle #857
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,23 +3,20 @@ import { withBoundingRects, WithBoundingRectsProps } from '@visx/bounds'; | |
|
||
import Tooltip, { TooltipProps, defaultStyles } from './Tooltip'; | ||
|
||
export type TooltipWithBoundsProps = { | ||
offsetLeft?: number; | ||
offsetTop?: number; | ||
} & TooltipProps & | ||
export type TooltipWithBoundsProps = TooltipProps & | ||
React.HTMLProps<HTMLDivElement> & | ||
WithBoundingRectsProps; | ||
|
||
function TooltipWithBounds({ | ||
children, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. abc ordering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is abc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry updated |
||
getRects, | ||
left: initialLeft = 0, | ||
top: initialTop = 0, | ||
offsetLeft = 10, | ||
offsetTop = 10, | ||
children, | ||
rect: ownBounds, | ||
parentRect: parentBounds, | ||
getRects, | ||
rect: ownBounds, | ||
style = defaultStyles, | ||
top: initialTop = 0, | ||
unstyled = false, | ||
...otherProps | ||
}: TooltipWithBoundsProps) { | ||
|
@@ -44,12 +41,12 @@ function TooltipWithBounds({ | |
|
||
return ( | ||
<Tooltip | ||
top={top} | ||
left={left} | ||
offsetTop={0} | ||
offsetLeft={0} | ||
style={style} | ||
unstyled={unstyled} | ||
style={{ | ||
left: 0, | ||
top: 0, | ||
transform: `translate(${left}px, ${top}px)`, | ||
...(!unstyled && style), | ||
}} | ||
{...otherProps} | ||
> | ||
{children} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abc ordering