"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _carbonComponentsReact = require("carbon-components-react");

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

// import { Link } from 'react-router-dom';
function Button(_ref) {
  var text = _ref.text,
      onClick = _ref.onClick,
      href = _ref.href,
      appearance = _ref.appearance,
      disabled = _ref.disabled,
      className = _ref.className,
      title = _ref.title;
  var classString = 'usa-button' + (appearance && appearance !== 'default' ? ' usa-button--' + appearance : '') + (className ? ' ' + className : '');

  if (onClick === 'submit') {
    return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
      type: "submit",
      className: classString
    }, text);
  }

  onClick = typeof onClick === 'function' ? onClick : function () {};

  if (href) {
    return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, {
      href: href,
      className: classString,
      onClick: onClick,
      title: title
    }, text);
  }

  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
    className: classString,
    disabled: disabled,
    onClick: onClick,
    type: "button",
    title: title
  }, text);
}