All files / components/profile-card profile-info-list.jsx

100% Statements 8/8
100% Branches 2/2
75% Functions 3/4
100% Lines 8/8
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          1x 2x         1x 1x 1x                     1x               1x       1x          
import React from 'react';
import PropTypes from 'prop-types';
 
class ProfileInfoList extends React.Component {
  render() {
    const dataList = this.props.list.map((info, i) => {
      return (
        <li key={i}>
          <a
            href={info.link}
            onClick={info.onClick ? e => {
               e.preventDefault();
               e.stopPropagation();
               info.onClick();
             } : () => {}}
          >
            {info.description}
            <span className={"pull-right badge " + info.badgeTheme}>
              {info.stats}
            </span>
          </a>
        </li>
      );
    });
    return (
      <ul className="nav nav-stacked">
        {dataList}
      </ul>
    );
  }
}
 
ProfileInfoList.propTypes = {
  list: PropTypes.array
};
 
ProfileInfoList.defaultProps = {
  list: []
};
 
export default ProfileInfoList