Giter VIP home page Giter VIP logo

loucadufault / magneticslider Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 49 KB

A lightweight extension of @material-ui's Slider component complying to a super-set of its API spec, that enables the thumb to snap to nearby marks on the slider with configurable behaviour.

License: MIT License

JavaScript 100.00%
material-ui react slider slider-component slider-range mui material-components slider-plugin sliders slider-animation

magneticslider's People

Contributors

loucadufault avatar

Watchers

 avatar  avatar

Forkers

muziebrasil

magneticslider's Issues

Make it easier to overcome the magnetic force when grabbing at a magnetic mark and dragging away

Note that clicking right next to the magnetic mark should not trigger this effect, only dragging away from the magnetic mark should.

So long as we can get the previous value in the onChange hook (as well as the newValue), then we can check if the previous value was both 1) closer to a magnetic mark than the newValue (but not on the magnetic mark) and 2) in the (potentially scaled) radius of that magnetic mark. Then we would know that we were escaping that magnetic mark, and to continue escaping it.

Make it so that magnetic scale is not required for magnetism

It should default to 1.

Workaround: supply the item magneticScale: 1 to all mark objects in the marks array passed to the component. E.g.:

<MagneticSlider
    ...
    marks={[0,20,37,100].map(x => ({value: x, label: x + "°C", magneticScale: 1}))}
    ...                                                        ^^^^^^^^^^^^^^^^
/>

add typing/declarations

Could not find a declaration file for module 'magnetic-slider'. 'test-project/node_modules/magnetic-slider/lib/MagneticSlider.js' implicitly has an 'any' type.

Publish as npm package

  1. Investigate if this is desirable or typically done for mui extensions (otherwise?)
  2. figure out what other code or infra needs to be added to repo for packaging and registry
  3. impl

long-term: implement dependabot and versioning and release gitflow

Add tests

figure out how to design tests for react components
maybe puppeteer? storybook, jest snapshots ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.