import { Checkbox } from '@megafon/ui-core';
Код CheckboxWrapperexport const CheckboxWrapper: React.FC<ICheckboxWrapperProps> = (props) => {const [checked, setChecked] = React.useState<boolean>(false);const handleChange = () => {setChecked(!checked);};return (<div style={{ padding: '20px 10px 8px 10px' }}>{props.children({checked,onChange: handleChange,})}</div>);};
<CheckboxWrapper> {({ checked, onChange }) => <Checkbox checked={checked} onChange={onChange} fontSize="small" > I agree </Checkbox> } </CheckboxWrapper>
<CheckboxWrapper> {({ checked, onChange }) => <Checkbox checked={checked} onChange={onChange} error> I agree </Checkbox> } </CheckboxWrapper>
<CheckboxWrapper> {({ checked, onChange }) => <Checkbox checked={checked} onChange={onChange} color="light" > I agree </Checkbox> } </CheckboxWrapper>
<CheckboxWrapper> {({ checked, onChange }) => <Checkbox checked={checked} onChange={onChange} extraContent={ <div style={extraContentStyle}> Some Extra Content </div> } > I agree </Checkbox> } </CheckboxWrapper>
Код extraContentStyleconst extraContentStyle = { backgroundColor: '#00B956', color: '#FFF', padding: '5px'};
<CheckboxWrapper> {() => <Checkbox disabled>I agree</Checkbox>} </CheckboxWrapper>
<CheckboxWrapper> {() => <Checkbox checked disabled>I agree</Checkbox>} </CheckboxWrapper>