Skip to content
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

feat: useScrollbarWidth hook; #825

Merged
merged 3 commits into from
Dec 9, 2019
Merged

feat: useScrollbarWidth hook; #825

merged 3 commits into from
Dec 9, 2019

Conversation

xobotyi
Copy link
Contributor

@xobotyi xobotyi commented Dec 8, 2019

Description

This hook uses @xobotyi/scrollbar-width underneath, which is well tested and grown from my scrollbars component.

This PR absorbs #653

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas
  • Add documentation
  • Add hook's story at Storybook
  • Cover changes with tests
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

@xobotyi
Copy link
Contributor Author

xobotyi commented Dec 8, 2019

@streamich the only thing im not sure in - should it be exported by default and be a default dependency or make it optional?
@xobotyi/scrollbar-width is tiny enough so can be exported as default, but it is on you to decide.

@streamich
Copy link
Owner

@xobotyi As I understand it can return undefined only when called before DOM is ready. What would be a case when React renders and DOM is not ready yet?

@xobotyi
Copy link
Contributor Author

xobotyi commented Dec 9, 2019

@streamich if developer added react bundle before the closing body tag and/or placed in iframe.
Had several issues related to that behavior: #115 and #123

@xobotyi xobotyi requested a review from streamich December 9, 2019 09:10
Copy link
Owner

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Thanks! I think having it as default dependency is good.

package.json Outdated
@@ -78,6 +79,7 @@
"@testing-library/react-hooks": "3.2.1",
"@types/jest": "24.0.23",
"@types/react": "16.9.11",
"@xobotyi/scrollbar-width": "1.5.0",
Copy link
Owner

Choose a reason for hiding this comment

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

We already have it in "dependencies", probably this line is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forgot to remove from dev-deps.

@xobotyi xobotyi merged commit 125c7e9 into master Dec 9, 2019
@xobotyi xobotyi deleted the useScrollbarWidth branch December 9, 2019 12:47
streamich pushed a commit that referenced this pull request Dec 9, 2019
# [13.12.0](v13.11.0...v13.12.0) (2019-12-09)

### Features

* useScrollbarWidth hook; ([#825](#825)) ([125c7e9](125c7e9))
@streamich
Copy link
Owner

🎉 This PR is included in version 13.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants