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

feat(#217): CH.Slideshow autoPlay and autoPlayLoop #250

Merged
merged 14 commits into from
Aug 1, 2022

Conversation

brianespinosa
Copy link
Contributor

@brianespinosa brianespinosa commented Jul 29, 2022

Resolves #217

  • Adds props autoPlay and autoPlayLoop to CH.Slideshow component.
  • Adds methods for slideNext() and slidePrevious() to make code easier to follow and DRY when used in useEffect
  • Adds disabled state for Prev/Next buttons if slideshow is at the beginning or end
  • Side effect for timeout has cleanup in case Slideshow gets de-rendered before the configured timeout duration calls
  • If autoPlayLoop is not configured, prevent side effect and timeout are not called again
  • if autoPlayLoop is configured, an additional timeout is set to allow the last slide to show before resetting to the beginning slide
  • useEffect does not change state if autoPlay is not configured.

@vercel
Copy link

vercel bot commented Jul 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
chtest ✅ Ready (Inspect) Visit Preview Sep 1, 2022 at 10:52AM (UTC)
playground ✅ Ready (Inspect) Visit Preview Sep 1, 2022 at 10:52AM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 29, 2022

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

…deshow-auto

# Conflicts:
#	packages/mdx/src/mdx-client/slideshow.tsx
@brianespinosa
Copy link
Contributor Author

brianespinosa commented Jul 29, 2022

If you merge the other PR and there are conflicts here, @ me if you want me to go through to resolve them. 👍🏽

@vercel vercel bot temporarily deployed to Preview – chtest July 29, 2022 21:43 Inactive
@vercel vercel bot temporarily deployed to Preview – playground July 29, 2022 21:44 Inactive
@pomber
Copy link
Contributor

pomber commented Jul 30, 2022

Thank you.

  • I think we should call the props autoPlay and loop, similar to the HTML video element attributes
  • Can you remove the framer-motion dependency?
  • I may add some changes on top of yours if you don't mind

@vercel vercel bot temporarily deployed to Preview – chtest July 30, 2022 20:53 Inactive
@brianespinosa
Copy link
Contributor Author

brianespinosa commented Jul 30, 2022

  • I think we should call the props autoPlay and loop, similar to the HTML video element attributes

Done.

  • Can you remove the framer-motion dependency?

Yikes. I accidentally branched from the wrong spot on my end where I was trying to see if I could get presence animation working for motion components in slides. Luckily there were not many changes to back out.

  • I may add some changes on top of yours if you don't mind

Go for it.

Conflicts resolved from the previous branch merge.

@vercel vercel bot temporarily deployed to Preview – playground July 30, 2022 20:56 Inactive
@vercel vercel bot temporarily deployed to Preview – playground August 1, 2022 10:51 Inactive
@vercel vercel bot temporarily deployed to Preview – chtest August 1, 2022 10:52 Inactive
@pomber pomber merged commit 9683b5b into code-hike:next Aug 1, 2022
This was referenced Aug 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2022

🚀 PR was released in v0.7.3 🚀

@brianespinosa brianespinosa deleted the slideshow-auto branch August 16, 2022 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Slideshow autoplay
2 participants