ActionButton.js 974 Bytes
// import { ActionButton }                        from '/imports/client/components/actionButton/actionButton';
import _                                  from 'lodash';
import React, { Component }               from 'react';
import { Loading }                        from '/imports/client/components/Loading';

import classNames                         from 'classnames';

/*
  <ActionButton
    loading   = {this.state.loading}
    onAction  = {() => this.onSend()}
    // error     = {this.state.error}
  >
    Send invite
  </ActionButton>
*/

export class ActionButton extends Component {


  render() {
    if(this.props.loading) {
      return (
        <div className = {this.props.className || ""}>
          <Loading/>
        </div>
      );
    }

    return (
      <div
        className = {this.props.className || ""}
        onClick   = {() => (this.props.onAction && this.props.onAction())}
      >
        {this.props.children}
      </div>
    );
  };
};