diff options
Diffstat (limited to 'src/utils/SpinnerContainer.jsx')
-rw-r--r-- | src/utils/SpinnerContainer.jsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/utils/SpinnerContainer.jsx b/src/utils/SpinnerContainer.jsx new file mode 100644 index 0000000..448999c --- /dev/null +++ b/src/utils/SpinnerContainer.jsx @@ -0,0 +1,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 +}; + |