import React from 'react'; import PropTypes from 'prop-types'; import { Form, SwitchControl } from '@edx/paragon'; import './FormSwitchGroup.scss'; export default function FormSwitchGroup({ id, name, label, helpText, className, onChange, onBlur, checked, }) { const helpTextId = `${id}HelpText`; // Note that we use controlId here _and_ set some IDs and aria-describedby attributes manually. // controlId doesn't cover Form.Switch properly, so controlId is just helping to attach // a 'for' attribute to the Label. return (
{label}
{helpText}
); } FormSwitchGroup.propTypes = { id: PropTypes.string.isRequired, label: PropTypes.node.isRequired, name: PropTypes.string, helpText: PropTypes.node.isRequired, className: PropTypes.string, onChange: PropTypes.func.isRequired, onBlur: PropTypes.func, checked: PropTypes.bool.isRequired, }; FormSwitchGroup.defaultProps = { className: null, onBlur: null, name: null, };