UNPKG

@brizy/ui

Version:
11 lines (10 loc) 516 B
import React, { useCallback } from "react"; import AntSwitch from "antd/lib/switch"; export const Switch = (props) => { const { checked, size = "default", onClick, onChange, disabled } = props; const handleChange = useCallback((e) => { if (!disabled) onChange === null || onChange === void 0 ? void 0 : onChange(e); }, [onChange, disabled]); return React.createElement(AntSwitch, { checked: checked, size: size, onChange: handleChange, onClick: onClick, disabled: disabled }); };