Conversation
🦋 Changeset detectedLatest commit: 1cfa89b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new React hook useScrollProgress that tracks the scroll progress of elements within containers, enabling scroll-based animations and interactions.
- Adds comprehensive scroll progress tracking with both inner and outer progress calculations
- Provides TypeScript definitions for entry data, callback functions, and configuration options
- Implements efficient event handling with IntersectionObserver optimization and requestAnimationFrame smoothing
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
3636703 to
5432e1f
Compare
5432e1f to
269ad7a
Compare
269ad7a to
c9e4232
Compare
c9e4232 to
1cfa89b
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. @@ Coverage Diff @@
## main #602 +/- ##
==========================================
- Coverage 73.80% 71.17% -2.63%
==========================================
Files 62 63 +1
Lines 2111 2189 +78
Branches 295 295
==========================================
Hits 1558 1558
- Misses 541 619 +78
Partials 12 12
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| // Attach event listeners to update progress. | ||
| scrollContainer.addEventListener('scroll', scheduleUpdate, { passive: true }) | ||
| window.addEventListener('resize', scheduleUpdate) |
There was a problem hiding this comment.
Why not use an ResizeObserver on the scrollContainer instead?
So an update is triggered if the container's height changes regardless of the window size.
There was a problem hiding this comment.
Good point! I'll look into it, thanks for feedback ✨
Add new hook to spy scroll progress on elements. Useful for creating scroll based animations.
Check out the Codesandbox demo.