summaryrefslogtreecommitdiffstats
path: root/src/utils/SpinnerContainer.jsx
blob: 448999cffcee6593f4c341ceb75958921e705a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { Component } from 'react';
import { ClipLoader } from 'react-spinners';
import {COLOR_BLUE} from 'utils/GlobalConstants.js';

class SpinnerContainer extends Component {
  render() {
    // if loading, show content as busy (ex: grey out)
    const spinnerContentClass = this.props.loading ? 'spinner-content' : '';
    return (
      <div className='spinner-container'>
        <div className='spinner'>
          <ClipLoader color={COLOR_BLUE} loading={this.props.loading} />
        </div>
        <div className={spinnerContentClass}>
          {this.props.children}
        </div>
      </div>
    );
  }
}
export default SpinnerContainer;

SpinnerContainer.propTypes = {
  loading: React.PropTypes.bool
};

SpinnerContainer.defaultProps = {
  loading: false
};