import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; class CircleChartLegend extends React.Component { constructor(props) { super(props); } getList() { const {data} = this.props; return data.map(({ value, label, sliceIndex }, index) => { const swatchClass = `swatch-${sliceIndex}`; return (
  • {label} {this.getPercentage(value)}
  • ); }); } getPercentage(value) { const num = value * 100; return `${num}%`; } renderList() { return ( ); } render() { return (
    {this.renderList()}
    ); } } CircleChartLegend.propTypes = { data: PropTypes.array.isRequired } export default CircleChartLegend;