-
Notifications
You must be signed in to change notification settings - Fork 50
Added smoothe page scrolling across all pages using lenis #74
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
Conversation
|
@coderabbitai generate docstrings |
WalkthroughAdded the Lenis dependency and integrated smooth-scrolling in App by initializing Lenis in a useEffect hook, driving it via requestAnimationFrame, and cleaning up on unmount. No API or routing changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App
participant Lenis
participant rAF as requestAnimationFrame
participant DOM as Document
User->>App: Load/Mount
App->>Lenis: new Lenis(options)
App->>rAF: start loop
loop animation frame
rAF->>App: frame(time)
App->>Lenis: lenis.raf(time)
Lenis->>DOM: update scroll position smoothly
end
User->>DOM: Scroll input
DOM->>Lenis: scroll events
Lenis->>DOM: managed smooth scrolling
App-->>Lenis: Unmount → destroy()
Lenis-->>DOM: cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @Yash-Bandal. * #74 (comment) The following files were modified: * `src/App.jsx`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/App.jsx (1)
14-34: Consider using autoRaf for simpler setup.The manual requestAnimationFrame loop is valid, but Lenis supports an
autoRaf: trueoption that handles the animation loop internally, simplifying your code and cleanup logic.You could simplify to:
useEffect(() => { // Initialize Lenis for smooth scroll const lenis = new Lenis({ duration: 0.8, // scroll speed (0.8s for smooth flow) easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), // default easing smooth: true, - smoothTouch: false, // disable smooth on mobile for performance + syncTouch: false, // disable smooth on mobile for performance + autoRaf: true, }); - // RAF loop - const raf = (time) => { - lenis.raf(time); - requestAnimationFrame(raf); - }; - requestAnimationFrame(raf); - // Cleanup when component unmounts return () => { lenis.destroy(); }; }, []);Based on learnings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.json(2 hunks)src/App.jsx(2 hunks)
🔇 Additional comments (1)
package.json (1)
14-14: LGTM! Dependency version is current.The lenis dependency at version ^1.3.11 is correct and up-to-date (published Oct 6, 2025). Ensure the recommended lenis.css is imported in your application for proper layout and interaction behavior.
Based on learnings.
Description
This PR integrates Lenis for smooth scrolling throughout the website.
- Added Lenis initialization in App.jsx
- Configured requestAnimationFrame for continuous scroll updates
- Ensured cleanup on unmount for performance
- No breaking UI or route changes
Tested on: Home, Programs, Mentors, Contributors, and Community pages.
Summary by CodeRabbit
New Features
Chores