feat: add auto-play and pause on hover to hero banner carousel - #322
feat: add auto-play and pause on hover to hero banner carousel#322Pranav-IIITM wants to merge 1 commit into
Conversation
Signed-off-by: Pranav-IIITM <jogdandpranav2007@gmail.com>
✅ Deploy Preview for kmesh-net ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces custom autoplay and pause-on-hover functionality to the home slider using React hooks (useState, useEffect, useRef) and mouse event handlers. The reviewer recommends removing this custom implementation and instead utilizing the native autoplay, autoplaySpeed, and pauseOnHover properties provided by the react-slick library, which simplifies the component and removes unnecessary state management.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR adds auto-play behavior to the home page hero banner carousel, advancing slides automatically every 5 seconds and pausing while the user hovers over the banner.
Changes:
- Introduces a timer-driven auto-advance via
setInterval()callingslickNext()every 5000ms - Adds hover tracking to pause/resume the auto-play behavior
- Wires a
refintoreact-slick’s<Slider />instance so it can be advanced programmatically
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@LiZhenCheng9527 @nlgwcy Please review the PR !! |
|
/lgtm |
Summary
The hero banner carousel previously required manual interaction via arrow buttons to navigate between slides. This PR adds auto-play functionality, making the banner dynamic and engaging without requiring any user interaction.
Closes #321
Changes Made
src/components/slider/index.jsuseRefto hold a reference to thesetIntervalinstanceisHoveredstate to track mouse position over the bannersetIntervalcallingslickNext()every 5000ms to auto-advance slidesonMouseEnterhandler to pause auto-play on hoveronMouseLeavehandler to resume auto-play on mouse leaveuseEffectcleanup to clear the interval on component unmountBefore & After
Before
Kmesh-Video.1.mp4
After
Kmesh-Autoplay.video.1.mp4
Acceptance Criteria