Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afeiship/react-loading

Spinner component for react.
https://github.com/afeiship/react-loading

component react spinner

Last synced: 24 days ago
JSON representation

Spinner component for react.

Awesome Lists containing this project

README

        

# react-loading
> Spinner component for react.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-loading
```

## properties
| Name | Type | Required | Default | Description |
| ------------- | ------ | -------- | ----------------------- | --------------------------------------- |
| mainClassName | string | false | 'webkit-sassui-loading' | The loading key effect css className. |
| backdrop | union | false | - | Backdrop props or not display backdrop. |

## usage
1. import css
```scss
@import "~@feizheng/webkit-sassui-backdrop";
@import "~@feizheng/webkit-sassui-loading";
@import "~@feizheng/react-loading/dist/style.scss";

// customize your styles:
$react-loading-options: ()
```
2. import js
```js
import ReactLoading from '@feizheng/react-loading';
import ReactDOM from 'react-dom';
import React from 'react';
import { Controller } from '@feizheng/react-visible';
import './assets/style.scss';

class App extends React.Component {
state = {
value: false
};

componentDidMount() {
Controller.singleton(ReactLoading, {
// children: 'loading',
backdrop: {
transparent: true,
onClick: () => {
ReactLoading.dismiss(() => {
console.log('after dismiss');
});
}
}
});
}

render() {
return (


{
ReactLoading.present(
() => {
console.log('after present');
},
{ children: `[ ${Math.random().toString(36).slice(-6)} ]` }
);
}}>
Show Dynamic Loading.


);
}
}

ReactDOM.render(, document.getElementById('app'));
```

## documentation
- https://afeiship.github.io/react-loading/

## license
Code released under [the MIT license](https://github.com/afeiship/react-loading/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-loading
[version-url]: https://npmjs.org/package/@jswork/react-loading

[license-image]: https://img.shields.io/npm/l/@jswork/react-loading
[license-url]: https://github.com/afeiship/react-loading/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-loading
[size-url]: https://github.com/afeiship/react-loading/blob/master/dist/react-loading.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-loading
[download-url]: https://www.npmjs.com/package/@jswork/react-loading