Skip to content

Commit

Permalink
Fix tooltip position for elements on the right side of the screen [pu…
Browse files Browse the repository at this point in the history
…blish]
  • Loading branch information
ArnaudBarre committed Nov 7, 2022
1 parent bf4771e commit 940fff6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ jobs:
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, '[publish]') }}
steps:
- uses: actions/checkout@v2
- uses: xhyrom/setup-bun@v0.1.7
- run: rm -rf ~/.bun/install/cache
- uses: actions/checkout@v3
- uses: xhyrom/setup-bun@v0.1.8
with:
bun-version: "0.2.1"
- run: bun install
- run: bun ci
- uses: ArnaudBarre/npm-publish@v1.1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.1

Fix tooltip position for elements on the right side of the screen

## 1.0.0

Initial release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-react-click-to-component",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"scripts": {
"dev": "scripts/bundle.ts --dev",
Expand Down
9 changes: 9 additions & 0 deletions playground/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@
.read-the-docs {
color: #888;
}

.full-height {
position: fixed;
top: 20px;
bottom: 20px;
left: 40px;
display: flex;
align-items: center;
}
2 changes: 2 additions & 0 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const App = () => {

return (
<div className="App">
<div style={{ position: "fixed", right: 40, top: 40 }}>Top right</div>
<div className="full-height">Full height</div>
<div>
<a href="https://vitejs.dev" target="_blank" rel="noreferrer">
<img src="/vite.svg" className="logo" alt="Vite logo" />
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ window.addEventListener("mousemove", (event) => {
tooltipElement.style.left = `${rect.left}px`;
tooltipElement.style.right = "";
} else {
tooltipElement.style.right = `${rect.right}px`;
tooltipElement.style.right = `${window.innerWidth - rect.right}px`;
tooltipElement.style.left = "";
}
if (!hasTooltip) {
Expand Down

0 comments on commit 940fff6

Please sign in to comment.