import * as React from "react";
import { PrimaryButton as CorePrimaryButton } from "office-ui-fabric-react";

export class PrimaryButton extends React.Component<any, any> {
  constructor(props: any) {
    super(props);
    this.state = {
      disabled: false
    };
  }

  block() {
    this.setState({ disabled: true });
  }

  unblock() {
    this.setState({ disabled: false });
  }

  private onclickButton() {
    if (this.props.onClick) this.props.onClick(this);
  }

  render() {
    //{this.pros}
    return (
      <CorePrimaryButton
        {...this.props}
        disabled={this.state.disabled || this.props.disabled}
        onClick={this.onclickButton.bind(this)}
      />
    );
  }
}

// export default NewPrimaryButton;
