GithubHelp home page GithubHelp logo

awibox / react-promise-loader Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 2.08 MB

This is NPM package with a component for React that will help you display the loader at use react-promise-tracker

License: MIT License

JavaScript 100.00%
react-component npm-package loader-component loader promise-tracker

react-promise-loader's Introduction

react-promise-loader

Version Build Coverage Minified size Downloads PRs Welcome Tested with jest

Table of contents

Installation

You need to install promise loader and promise tracker packages:

npm install react-promise-loader react-promise-tracker

You can use yarn:

yarn add react-promise-loader react-promise-tracker

Getting started

Wrap promises that you would like to track as in the following example:

+ import { trackPromise} from 'react-promise-tracker';
//...

+ trackPromise(
    fetchUsers(); // You function that returns a promise
+ );

Then you need to add the Loader component and send data from the react-promise-tracker:

+ import { usePromiseTracker } from 'react-promise-tracker';
+ import Loader from 'react-promise-loader';

const App = () => (
  <div className="app">
    ...
+     <Loader promiseTracker={usePromiseTracker} color={'#3d5e61'} background={'rgba(255,255,255,.5)'} />
  </div>
);
export default App;

The settings of the component

Parameter Type Description Default
background string Sets the color for the background in any format that supports css rgba(255,255,255,.5)
color string Sets the color of the spinner #000
promiseTracker boolean You need to set usePromiseTracker function from the react-promise-tracker false
loading boolean If you need to run the loader without tracking promises you should set true false
zIndex number You can change the z-index to distribute the layers correctly 999

Contributing

Please read through our CONTRIBUTING.md.

react-promise-loader's People

Contributors

awibox avatar deepsourcebot avatar dependabot-preview[bot] avatar dependabot[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

muffrank

react-promise-loader's Issues

React 18 support

Can package.json be updated to support React/React-DOM 18?

We currently have to use the --force flag when running npm install to get around the dependency issue

npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^18.2.0" from the root project
npm WARN   15 more (@ramonak/react-progress-bar, @react-aria/ssr, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^17.0.1" from [email protected]
npm WARN node_modules/react-promise-loader
npm WARN   react-promise-loader@"^1.2.0" from the root project
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^17.0.1" from [email protected]
npm WARN   node_modules/react-promise-loader
npm WARN     react-promise-loader@"^1.2.0" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^18.2.0" from the root project
npm WARN   6 more (@ramonak/react-progress-bar, @restart/ui, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^17.0.1" from [email protected]
npm WARN node_modules/react-promise-loader
npm WARN   react-promise-loader@"^1.2.0" from the root project
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^17.0.1" from [email protected]
npm WARN   node_modules/react-promise-loader
npm WARN     react-promise-loader@"^1.2.0" from the root project

Thanks!

Please add support to add custom z-index

Is your feature request related to a problem? Please describe.
Z-Index Problem with other elements like Bootstrap modal

Describe the solution you'd like
Ability to add z-index in the props

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.