All files / components/utilities load-status.jsx

100% Statements 3/3
50% Branches 3/6
100% Functions 1/1
100% Lines 3/3
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 31 32 33 34 35 36 37 38          2x                       3x                     3x                  
import React from 'react';
import PropTypes from 'prop-types';
 
class LoadStatus extends React.Component {
  render() {
    return (
      <div style={{
        fontSize: typeof this.props.size === 'number' ? `${this.props.size}px` : this.props.size,
        color: this.props.color
      }}>
        <i className={`fa ${this.props.icon}${this.props.spins ? ' fa-spin' : ''}`} />
        {this.props.message ? (<span>&nbsp;{this.props.message}</span>) : ''}
      </div>
    );
  }
}
 
LoadStatus.propTypes = {
  message: PropTypes.string,
  icon: PropTypes.string,
  spins: PropTypes.bool,
  color: PropTypes.string,
  size: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number
  ])
};
 
LoadStatus.defaultProps = {
  message: '',
  icon: 'fa-refresh',
  spins: false,
  size: '1em',
  color: '#000000'
};
 
export default LoadStatus;