import Button from '../../button';
import Rating from '..';
import React from 'react';
import ReactDOM from 'react-dom';

interface PageStates{
  isPreview:boolean
}
class Preview extends React.Component <{}, PageStates> {
  constructor(props) {
    super(props);
    this.state = { isPreview: false };
  }

  render() {
    return (
      <div>
        <Button
          type="primary"
          onClick={() => this.setState({ isPreview: !this.state.isPreview })}
        >
          切换预览
        </Button>
        <br />
        <br />
        <Rating
          defaultValue={3.5}
          // @ts-ignore
          isPreview={this.state.isPreview}
          renderPreview={value => `Rating: ${value}`}
        />
      </div>
    );
  }
}
ReactDOM.render(
  <Preview />,
  document.getElementById('rating-demo-7'),
);
