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

Improved TypeScript version #8

Closed
mindplay-dk opened this issue May 13, 2019 · 2 comments
Closed

Improved TypeScript version #8

mindplay-dk opened this issue May 13, 2019 · 2 comments

Comments

@mindplay-dk
Copy link

Hi there,

Thank you for an absolutely brilliant starting point! :-)

I love the simple, elegant approach you took with this - and decided to continue with some changes and features I needed in my own project:

  • Ported to TypeScript.
  • Touch/drag interactions improved and simplified.
  • Virtualized slides: only 4 slides are physically in the DOM at one time, so you effectively get lazy-loading of images, iframes, etc.
  • Seamless loop: the last slide appears to be located before the first.

Note that I also removed some features and all of the options - and added a simple, public API, so that the parent example gallery component can send commands using a ref.

The whole things is still somehow only 200 lines of code ;-)

I'll just post it here for you and others to enjoy:

https://stackblitz.com/edit/react-slider-ttttt

Of course, feel free to use this under MIT, same as how you published it :-)

Thanks again!

@Stanko
Copy link
Owner

Stanko commented May 13, 2019

Hey @mindplay-dk,
This is awesome! Thank you for sharing 🙂 I wrote this thing couple of years ago, and I never got to refactor it and publish it.

I think you should package this thing up and publish it to npm. I'll link this issue in the readme.

Cheers!

EDIT: https://github.com/Stanko/react-slider#typescript-version

@mindplay-dk
Copy link
Author

I think you should package this thing up and publish it to npm

Thanks for the vote of confidence :-)

But I have a very pragmatic point of view when it comes to UI code: unless it's something substantially more complex than this, I rarely build for reuse, because UI behavior/details is usually where projects differ the most. I prefer building for the exact requirements of the use-case - and I'm perfectly comfortable copy/pasting 200 lines of code and maintaining another copy with customizations for the exact case.

If somebody wants a packaged version, it's in the open source domain, and they can feel free - I personally wouldn't use a package for something this small 😉

@Stanko Stanko closed this as completed May 13, 2019
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

No branches or pull requests

2 participants