import React from 'react';
import ReactDOM from 'react-dom';
import Transfer from '..';

const dataSource = (() => {
  const dataSource = [];

  for (let i = 0; i < 1000; i++) {
    dataSource.push({
      label: `content${i}`,
      value: `${i}`,
      disabled: i % 4 === 0,
    });
  }

  return dataSource;
})();

class Demo extends React.Component {
  constructor(props) {
    super(props);

    this.handleChange = this.handleChange.bind(this);
  }

  handleChange(value, data, extra) {
    console.log(value, data, extra);
  }

  render() {

    return (
      <div className="white">
        <Transfer
          mode="simple"
          useVirtual
          theme="white"
          defaultValue={[ '3' ]}
          dataSource={dataSource}
          defaultLeftChecked={[ '1' ]}
          onChange={this.handleChange}
          titles={[ 'Simple Mode', 'Simple Mode' ]}
        />
      </div>
    );
  }
}

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