/** * A checkbox field with a label that reacts to an onFieldChange event. * @example * field = { * "id": 138, * "attribute_name": "display_email_on_profile", * "description": "", * "input_type": "check_box", * "label": "Display email on profile", * "placeholder_text": "" } * * Note: * field is an json object that will contain the following attributes: attribute_name, placeholder_text, description, label. */ import { h } from 'preact'; import PropTypes from 'prop-types'; import { FormField } from '@crayons'; function CheckBox(props) { const { onFieldChange } = props; const { attribute_name, description, label } = props.field; return ( {description &&

{description}

}
); } CheckBox.propTypes = { field: PropTypes.shape({ attribute_name: PropTypes.string.isRequired, description: PropTypes.string.isRequired, label: PropTypes.string.isRequired, input_type: PropTypes.string.isRequired, }).isRequired, }; export default CheckBox;