import React from 'react';
import ReactDOM from 'react-dom';
import {Actions} from 'nylas-exports';
import QuickEventPopover from './quick-event-popover';

export default class QuickEventButton extends React.Component {

  onClick = (event) => {
    event.stopPropagation()
    const buttonRect = ReactDOM.findDOMNode(this).getBoundingClientRect()
    Actions.openPopover(
      <QuickEventPopover />,
      {originRect: buttonRect, direction: 'down'}
    )
  };

  render() {
    return (
      <button
        tabIndex={-1}
        className="btn btn-toolbar"
        onClick={this.onClick}
      >
      +
      </button>
    );
  }
}
