Skip to content

Commit

Permalink
Use toString instead of toFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
iwan-uschka committed Feb 8, 2025
1 parent 75f571b commit 7b74d4c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Component() {
return (
<>
{Array.from({ length: 5 }).map((_, index) => (
<Section key={index + 1} title={(index + 1).toFixed()} />
<Section key={index + 1} title={(index + 1).toString()} />
))}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('useScrollLock()', () => {
const scrollbarWidth = window.innerWidth - document.body.scrollWidth

expect(document.body.style.paddingRight).toBe(
`${scrollbarWidth.toFixed()}px`,
`${scrollbarWidth.toString()}px`,
)
unmount()
expect(document.body.style.paddingRight).toBe('')
Expand Down
2 changes: 1 addition & 1 deletion packages/usehooks-ts/src/useScrollLock/useScrollLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function useScrollLock(
0

const scrollbarWidth = offsetWidth - target.current.scrollWidth
target.current.style.paddingRight = `${(scrollbarWidth + currentPaddingRight).toFixed()}px`
target.current.style.paddingRight = `${(scrollbarWidth + currentPaddingRight).toString()}px`
}

// Lock the scroll
Expand Down

0 comments on commit 7b74d4c

Please sign in to comment.