浏览代码

Added loading style to entire CRUD document list if the list is refreshing

Fela Maslen 7 年之前
父节点
当前提交
2babc291f6
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 4 1
      src/containers/CrudList/index.js
  2. 10 0
      src/containers/CrudList/style.scss

+ 4 - 1
src/containers/CrudList/index.js

@@ -1,6 +1,7 @@
 import { connect } from 'react-redux';
 import React, { Component } from 'react';
 import PropTypes from 'prop-types';
+import classNames from 'classnames';
 import uniqid from 'uniqid';
 
 import {
@@ -19,6 +20,8 @@ import LoadingIndicator from 'components/LoadingIndicator';
 import CrudDocument from 'components/CrudDocument';
 import AddCrudItem from 'components/AddCrudItem';
 
+import './style.scss';
+
 const mapStateToProps = (state, { route }) => ({
     loading: getCrudLoading(state, route),
     items: getDocs(state, route)
@@ -90,7 +93,7 @@ class CrudList extends Component {
         ));
 
         return (
-            <div className="crud-list-wrapper">
+            <div className={classNames('crud-list-wrapper', { loading })}>
                 <div className="head">
                     <h3 className="title">{title}</h3>
                     <div className="meta">

+ 10 - 0
src/containers/CrudList/style.scss

@@ -0,0 +1,10 @@
+@import '~variables';
+
+.crud-list-wrapper {
+    &.loading {
+        .body {
+            opacity: $opacity-pending;
+        }
+    }
+}
+