WTW-IM / es-components

React components built for products in Exchange Solutions
https://wtw-im.github.io/es-components/
18 stars 35 forks source link

Add delay to spinner #405

Open bradyclifford opened 4 years ago

bradyclifford commented 4 years ago

To prevent a less than a second spinner, can we add an animation property that will prevent the spinner from showing unless it passes a certain duration? And perhaps that duration can be customizable.

An example: https://jsfiddle.net/ecmanaut/4yAQB/

And how to prevent spinners from jumping: https://www.selbekk.io/blog/2019/08/how-to-stop-your-spinner-from-jumping-in-react/

bradyclifford commented 4 years ago

Perhaps this should be done within a micro-frontend instead for specific needs. https://disjoint.ca/til/2017/09/21/how-to-delay-the-display-of-loading-animations-in-react/

aabenoja commented 4 years ago

@Darrken Applying this to the spinner seems a bit heavy-handed when the spinner shouldn't need to care if the process using it is resolving too quickly. If anything we could provide either a pattern or utility to encapsulate what is demonstrated in that article from disjoint, but we should be open to open source options such as react-loadable and other "loading" components available on npm.