import Radio from '..';
import React from 'react';
import ReactDOM from 'react-dom';
const RadioGroup = Radio.Group;
const list = [
  {
    value: 'apple',
    label: 'Apple',
    disabled: false,
  },
  {
    value: 'pear',
    label: 'Pear',
  },
  {
    value: 'orange',
    label: 'Orange',
    disabled: true,
  },
];

interface PageStates {
  value: string;
  buttonValue: string;
}
class App extends React.Component<{}, PageStates> {
  onChange: (value: any) => void;
  onButtonChange: (value: any) => void;
  constructor(props) {
    super(props);

    this.onChange = value => {
      this.setState({
        value,
      });
    };
    this.onButtonChange = value => {
      this.setState({
        buttonValue: value,
      });
    };
    this.state = {
      value: 'apple',
      buttonValue: 'pear',
    };
  }

  render() {
    return (
      <div>
        <RadioGroup
          dataSource={list}
          value={this.state.value}
          onChange={this.onChange}
        />
        <br />
        <br />
        <RadioGroup
          dataSource={list}
          shape="button"
          value={this.state.buttonValue}
          onChange={this.onButtonChange}
        />
      </div>
    );
  }
}
ReactDOM.render(<App />, document.getElementById('radio-demo-3'));
