Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson committed Feb 15, 2023
1 parent 69c4ebc commit 6b05149
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ const useQueryState = query => {
const Tooltip = ({ hoveredInfo }) => {
const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });

// position to right of mouse unless x is too close to right edge
const left_or_right = tooltipPosition.x > window.innerWidth - 200 ? {
right: `${window.innerWidth - tooltipPosition.x + 10}px`,
} : {
left: `${tooltipPosition.x + 10}px`,
};

const tooltipStyles = {
position: "absolute",
top: `${tooltipPosition.y + 20}px`,
left: `${tooltipPosition.x + 0}px`,
top: `${tooltipPosition.y + 10}px`,
...left_or_right,
visibility: hoveredInfo ? "visible" : "hidden",

zIndex: 1000,
Expand Down

1 comment on commit 6b05149

@vercel
Copy link

@vercel vercel bot commented on 6b05149 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.