Skip to content
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

Merged

Conversation

MohamedHabarneh
Copy link
Collaborator

@MohamedHabarneh MohamedHabarneh commented Oct 30, 2021

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)

@vercel
Copy link

vercel bot commented Oct 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ethanthatonekid/acm-csuf-site/5NuYpGqRKYFETKR1Di79PT7dMy9w
✅ Preview: https://acm-csuf-site-git-fork-mohamedhabarneh-m-887020-ethanthatonekid.vercel.app

@vercel vercel bot temporarily deployed to Preview October 30, 2021 21:04 Inactive
Copy link
Owner

@EthanThatOneKid EthanThatOneKid left a 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.

src/lib/components/events/event-carousel.svelte Outdated Show resolved Hide resolved
src/lib/components/events/event-carousel.svelte Outdated Show resolved Hide resolved
src/lib/components/events/event-carousel.svelte Outdated Show resolved Hide resolved
@EthanThatOneKid EthanThatOneKid linked an issue Oct 31, 2021 that may be closed by this pull request
@vercel vercel bot temporarily deployed to Preview November 1, 2021 19:40 Inactive
@EthanThatOneKid EthanThatOneKid self-requested a review November 1, 2021 22:28
Copy link
Owner

@EthanThatOneKid EthanThatOneKid left a 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.

src/lib/components/events/event-carousel.svelte Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview November 3, 2021 05:01 Inactive
Comment on lines 22 to 28
const canScrollLeft = carouselRef.scrollLeft > 0;
const canScrollRight =
carouselRef.scrollWidth - carouselRef.scrollLeft - carouselRef.clientWidth <
scrollIncrementDistance;
leftButtonEnabled = canScrollLeft;
rightButtonEnabled = canScrollRight;
};
Copy link
Owner

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);

@vercel vercel bot temporarily deployed to Preview November 5, 2021 17:02 Inactive
@vercel vercel bot temporarily deployed to Preview November 5, 2021 21:20 Inactive
@vercel vercel bot temporarily deployed to Preview November 6, 2021 00:30 Inactive
@vercel vercel bot temporarily deployed to Preview November 6, 2021 00:39 Inactive
Copy link
Owner

@EthanThatOneKid EthanThatOneKid left a 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.

@MohamedHabarneh MohamedHabarneh merged commit 17b60f0 into EthanThatOneKid:main Nov 6, 2021
@MohamedHabarneh MohamedHabarneh deleted the mohamed-contribution1 branch November 6, 2021 01:08
@EthanThatOneKid EthanThatOneKid added the good first issue Good for newcomers label Nov 7, 2021
@MohamedHabarneh MohamedHabarneh restored the mohamed-contribution1 branch November 16, 2021 22:31
@EthanThatOneKid EthanThatOneKid added the bugfix A PR that fixes a bug label Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix A PR that fixes a bug good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unneeded arrow buttons on event carousel ◀▶
2 participants