-
Notifications
You must be signed in to change notification settings - Fork 5
fix: correct indentation and formatting in HeroCarousel component #170
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
… better readability
WalkthroughAdds auto-rotation to the hero carousel using a 3-second interval controlled by a paused state. Implements pause-on-hover via mouse enter/leave handlers. The interval respects paused and is cleaned up on effect re-run or unmount. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant HeroCarousel
participant Effect as useEffect (auto-rotate)
participant Timer as setInterval (3s)
User->>HeroCarousel: Load component
HeroCarousel->>Effect: Mount effect with paused=false
Effect->>Timer: Start interval (advance slide)
Timer-->>HeroCarousel: Every 3s: setCurrent((i+1)%n)
User->>HeroCarousel: Mouse enter (hover)
HeroCarousel->>Effect: paused=true (re-run)
Effect->>Timer: Clear/stop interval
Note over HeroCarousel,Timer: Rotation paused while hovered
User->>HeroCarousel: Mouse leave
HeroCarousel->>Effect: paused=false (re-run)
Effect->>Timer: Restart interval
Timer-->>HeroCarousel: Resume advancing slides
HeroCarousel-->>Effect: Unmount
Effect->>Timer: Cleanup interval
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewersPoem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary by CodeRabbit