1.0.11 • Published 5 years ago

redux-source-with-block-ui v1.0.11

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

redux-source-with-block-ui

< Back to Project WebCube

NPM Version

Nodei

A React higher-order component for displaying React Block UI based on Redux states maintained by redux-source automatically

npm install --save redux-source-with-block-ui

It works great with redux-source-with-notify

Examples

Get Started

For redux-source's example:

// shopManageApp/containers/ShopList.js
import { connect } from 'react-redux';
import connectSource from 'redux-source-connect';
import withBlockUi from 'redux-source-with-block-ui';
import 'react-block-ui/style.css';
import { Loader } from 'react-loaders';
import 'loaders.css/src/animations/line-scale.scss';

import { actions, shopsSource } from '../ducks/shops';


@connectSource(shopsSource, {
  slice: state => state.shops,
})
@connect({
  actions,
})
@withBlockUi({
  loader: <Loader type="line-scale" color="#8159bb" />,
  keepInView = true, // optional
  sourceStateName = 'source', // optional
  ...otherReactBlockUiProps, // optional
})
export default class ShopList extends PureComponent {

Or you can create a custom wrapper:

// shopManageApp/hoc/withBlockUi.js
import React from 'react';
import originWithBlockUi from 'redux-source-with-block-ui';
import 'react-block-ui/style.css';
import { Loader } from 'react-loaders';
import 'loaders.css/src/animations/line-scale.scss';

export default function withBlockUi(config = {}) {
  const { keepInView, sourceStateName, ...otherProps } = config;
  return originWithBlockUi({
    ...otherProps,
    loader: <Loader type="line-scale" color="#8159bb" />,
    keepInView,
    sourceStateName,
  });
}
// shopManageApp/containers/ShopList.js
import { connect } from 'react-redux';
import connectSource from 'redux-source-connect';

import withBlockUi from '../hoc/withBlockUi'
import { actions, shopsSource } from '../ducks/shops';

@connectSource(shopsSource, {
  slice: state => state.shops,
})
@connect({
  actions,
})
@withBlockUi()
export default class ShopList extends PureComponent {
1.0.11

5 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago