import React from "react"; import "./Switch.scss"; import classNames from "classnames"; import JDlabel from "../../label/JDLabel"; import {s4} from "../../../utils/utils"; import Tooltip from "../../tooltip/Tooltip"; type IProps = { disabled?: boolean; checked?: boolean; onChange?(foo: boolean): void; label?: string | JSX.Element; ltxt?: string; rtxt?: string; tooltip?: string; } const JDswitch: React.FC = ({ disabled, checked = false, onChange, ltxt, tooltip, rtxt, label }) => { const handleCheckboxChange = () => { const flag = disabled ? checked : !checked; onChange && onChange(flag); }; const classes = classNames({ JDswitch__input: true }); const newId = s4(); return ( {label && } {tooltip && ( {tooltip} )} ); }; export default JDswitch;