File size: 939 Bytes
1e92f2d |
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 |
import { FormLabel } from '@automattic/components';
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import FormInputCheckbox from 'calypso/components/forms/form-checkbox';
export default class ChartLegendItem extends PureComponent {
static propTypes = {
attr: PropTypes.string.isRequired,
changeHandler: PropTypes.func.isRequired,
checked: PropTypes.bool.isRequired,
label: PropTypes.oneOfType( [ PropTypes.object, PropTypes.string ] ),
};
clickHandler = () => {
this.props.changeHandler( this.props.attr );
};
render() {
return (
<li className="chart__legend-option">
<FormLabel className="chart__legend-label is-selectable">
<FormInputCheckbox
checked={ this.props.checked }
className="chart__legend-checkbox"
onChange={ this.clickHandler }
/>
<span className={ this.props.className } />
{ this.props.label }
</FormLabel>
</li>
);
}
}
|