All files / components/utilities label.jsx

100% Statements 3/3
100% Branches 6/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          5x                   2x                 2x              
import React from 'react';
import PropTypes from 'prop-types';
 
class Label extends React.Component {
  render() {
    return (
      <span className={`label ${this.props.theme}`}>
        {this.props.icon ? <i className={`fa ${this.props.icon}`} /> : ''}
        {this.props.icon && this.props.stat ? ' ' : ''}
        {this.props.stat}
      </span>
    );
  }
}
 
Label.propTypes = {
  theme: PropTypes.string,
  icon: PropTypes.string,
  stat: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number
  ])
};
 
Label.defaultProps = {
  theme: 'label-primary',
  icon: '',
  stat: ''
};
 
export default Label;