import * as React from "react"
import { storiesOf } from "@storybook/react"
import Stream from "."

class Component extends React.Component<any, any> {
  public state = {
    actions: []
  }
  public render() {
    return (
      <div>
        actions
        {this.state.actions.map((action, idx) => (
          <div key={idx}>{JSON.stringify(action)}</div>
        ))}
        <Stream
          url="http://localhost:7999"
          // tslint:disable-next-line:jsx-no-lambda
          onAction={(action) => {
            this.setState({
              actions: this.state.actions.concat(action)
            })
          }}
        />
      </div>
    )
  }
}

storiesOf("Stream", module).add("Abcdef", () => <Component />)
