import React from 'react'; import PropTypes from 'prop-types'; import Checkbox from './Checkbox.js'; const Checklist = ({ items = [], className, onChange }) => (
{items.map((item, index) => { return (
{ let obj = {}; obj[item.value] = value; onChange(obj); }} data-test-id={item.dataTestId} />
); })}
); Checklist.propTypes = { items: PropTypes.arrayOf( PropTypes.shape({ label: PropTypes.string, value: PropTypes.string, checked: PropTypes.bool, disabled: PropTypes.bool, dataTestId: PropTypes.string }) ), className: PropTypes.string, onChange: PropTypes.func }; export default Checklist;