import { FC } from 'react'
interface SwitchProps {
    isOn: boolean;
    handleToggle: any;
    disabled?:boolean;
    label?:String;
}
const Switch : FC<SwitchProps> = ({isOn, handleToggle, disabled}) => {

        return(
        <>
            <input
                checked={isOn}
                onChange={handleToggle}
                className={'switch-checkbox'}
                id={`switch-new`}
                type="checkbox"
                disabled={disabled}
            />
            <label
                className={
                    disabled ? (isOn ? 'switch-label on disabled' : 'switch-label off disabled') : (isOn ? 'switch-label on' : 'switch-label off')}
                htmlFor={`switch-new`}
            >
                <span className={`switch-button`}/>
            </label>
        </>
    )
}

export default Switch