'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = Button;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Button = require('../../styles/cspace-input/Button.css');

var _Button2 = _interopRequireDefault(_Button);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var propTypes = {
  className: _react.PropTypes.string,
  icon: _react.PropTypes.bool,
  type: _react.PropTypes.string
};

var defaultProps = {
  type: 'button'
};

/**
 * A button.
 */
function Button(props) {
  var className = props.className,
      icon = props.icon,
      type = props.type,
      remainingProps = _objectWithoutProperties(props, ['className', 'icon', 'type']);

  var classes = (0, _classnames2.default)(icon ? _Button2.default.icon : _Button2.default.common, className);

  return _react2.default.createElement('button', _extends({
    className: classes,
    type: type
  }, remainingProps));
}

Button.propTypes = propTypes;
Button.defaultProps = defaultProps;