27 lines
540 B
JavaScript
27 lines
540 B
JavaScript
import { Form, Switch as AntSwitch } from 'antd';
|
|
import { ElementStatus } from 'core/types/statuses';
|
|
|
|
const Switch = ({
|
|
value,
|
|
setCurrentValue,
|
|
status,
|
|
validateStatus,
|
|
message,
|
|
...props
|
|
}) => {
|
|
return (
|
|
<Form.Item validateStatus={validateStatus} help={message}>
|
|
<AntSwitch
|
|
{...props}
|
|
disabled={status === ElementStatus.Disabled}
|
|
checked={value}
|
|
onChange={(checked, event) => {
|
|
setCurrentValue(checked);
|
|
}}
|
|
/>
|
|
</Form.Item>
|
|
);
|
|
};
|
|
|
|
export default Switch;
|