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

function onChange(checked) {
  console.log(`switch to ${checked}`);
}

ReactDOM.render(
  <div>
    <Switch
      autoWidth
      checkedChildren="on"
      unCheckedChildren="off"
      onChange={onChange}
    />
    <br />
    <br />
    <Switch
      autoWidth
      checkedChildren="已启用"
      unCheckedChildren="已关闭"
      onChange={onChange}
    />
    <br />
    <br />
    <Switch
      autoWidth
      checkedChildren={<Icon type="select" size="xs" />}
      unCheckedChildren={<Icon type="close" size="xs" />}
      onChange={onChange}
    />
  </div>,
  document.getElementById('switch-demo-4'),
);
