-
Notifications
You must be signed in to change notification settings - Fork 53
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
Removed unneeded arrow buttons for event carousel #178
Removed unneeded arrow buttons for event carousel #178
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ethanthatonekid/acm-csuf-site/5NuYpGqRKYFETKR1Di79PT7dMy9w |
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.
Wow this is a great start! I added some ideas that we discussed on Discord in my review comments.
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.
I added a comment for differentiating between the left and right buttons.
const canScrollLeft = carouselRef.scrollLeft > 0; | ||
const canScrollRight = | ||
carouselRef.scrollWidth - carouselRef.scrollLeft - carouselRef.clientWidth < | ||
scrollIncrementDistance; | ||
leftButtonEnabled = canScrollLeft; | ||
rightButtonEnabled = canScrollRight; | ||
}; |
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.
Let's wrap this code into to helper function we created before.
debounceTheScroll(() => {
const canScrollLeft = carouselRef.scrollLeft > 0;
const canScrollRight =
carouselRef.scrollWidth - carouselRef.scrollLeft - carouselRef.clientWidth < 1;
leftButtonEnabled = canScrollLeft;
rightButtonEnabled = canScrollRight;
}, Time.Second * 0.75);
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.
Great work! Thank you for contributing on this issue.
When the arrow buttons are unneeded they are hidden and return when the event carousel is scrollable.
Preceding abandoned PR: link-#177. (It included 3 unnecessary files along with the 1 file I wanted to change)