import React from 'react';
import ReactDOM from 'react-dom';
import Switch from '..';
import { Button } from '../..';

const Demo = () => {
  const [ disabled, setDisabled ] = React.useState(true);

  const toggle = () => {
    setDisabled(!disabled);
  };

  return (
    <div>
      <Switch autoWidth disabled={disabled} defaultChecked />
      <br />
      <br />
      <Button type="primary" onClick={toggle}>
        Toggle disabled
      </Button>
    </div>
  );
};

ReactDOM.render(<Demo />, document.getElementById('switch-demo-3'));
