All files / src/components/collection-stats-item collection-stats-item.jsx

82.09% Statements 55/67
60.98% Branches 25/41
100% Functions 12/12
82.98% Lines 39/47
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65    1x     1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   4x   48x   48x   1x         1x         1x         1x         1x         1x           1x 1x  
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
 
import styles from './collection-stats-item.less';
 
/**
 * The base class.IEE
 */
const BASE_CLASS = 'collection-stats-item';
 
/**
 * The primary label class.
 */
const PRIMARY_LABEL = `${BASE_CLASS}-primary-label`;
 
/**
 * The primary value class.
 */
const PRIMARY_VALUE = `${BASE_CLASS}-primary-value`;
 
/**
 * The label class.
 */
const LABEL = `${BASE_CLASS}-label`;

/**
 * The value class.I
 */
const VALUE = `${BASE_CLASS}-value`;I
 
/**EI
 * Component for a single collection stats item.
 */
class CollectionStatsItem extends Component {
  static displayName = 'CollectionStatsItemComponent';
 
  static propTypes = {
    label: PropTypes.string.isRequired,
    value: PropTypes.any.isRequired,
    primary: PropTypes.bool
  };
 
  /**
   * Render the component.
   *
   * @returns {React.Component} The component.
   */
  render() {
    return (
      <div className={classnames(styles[BASE_CLASS])}>
        <div className={classnames(styles[this.props.primary ? PRIMARY_LABEL : LABEL])}>
          {this.props.label}
        </div>
        <div className={classnames(styles[this.props.primary ? PRIMARY_VALUE : VALUE])}>
          {this.props.value}
        </div>
      </div>
    );
  }
}
 
export default CollectionStatsItem;
export { CollectionStatsItem };