import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import Grid from "../../Grid";
import Link from "../../Link";
import Button from "../../Button";
import makeStyles from "../../styles/makeStyles";
var getClasses = makeStyles(function (_ref) {
  var _ref$cleverUI = _ref.cleverUI,
      colors = _ref$cleverUI.colors,
      spaces = _ref$cleverUI.spaces;
  return {
    root: function root(_ref2) {
      var darkMode = _ref2.darkMode;
      return {
        paddingTop: spaces.md,
        paddingBottom: spaces.md,
        paddingLeft: spaces.lg,
        paddingRight: spaces.lg,
        backgroundColor: darkMode ? "#333333" : colors.neutral[100],
        display: "flex",
        justifyContent: "space-between",
        order: 2
      };
    },
    rootEmpty: {
      padding: spaces.lg,
      display: "flex",
      justifyContent: "space-between",
      order: 2
    },
    primaryButton: {
      marginLeft: "auto"
    }
  };
});

var DialogActions = function DialogActions(_ref3) {
  var className = _ref3.className,
      buttons = _ref3.buttons,
      buttonPrimary = _ref3.buttonPrimary,
      buttonSecondary = _ref3.buttonSecondary,
      darkMode = _ref3.darkMode,
      variant = _ref3.variant;
  var classes = getClasses({
    darkMode: darkMode
  });
  return /*#__PURE__*/React.createElement(Grid, {
    container: true,
    className: classnames(classes["root".concat(variant === "empty" ? "Empty" : "")], className),
    alignItems: "center"
  }, (!!buttonPrimary || !!buttonSecondary) && /*#__PURE__*/React.createElement(React.Fragment, null, !!buttonSecondary && /*#__PURE__*/React.createElement(Link, {
    to: buttonSecondary.to,
    target: "_blank",
    external: buttonSecondary.external,
    onClick: buttonSecondary.onClick,
    disabled: buttonSecondary === null || buttonSecondary === void 0 ? void 0 : buttonSecondary.disabled
  }, buttonSecondary.label), !!buttonPrimary && /*#__PURE__*/React.createElement(Button, {
    onClick: buttonPrimary.onClick,
    className: classes.primaryButton,
    disabled: buttonPrimary.disabled,
    isLoading: buttonPrimary.isLoading
  }, buttonPrimary.label)), !buttonPrimary && !buttonSecondary && buttons);
};

DialogActions.propTypes = {
  className: PropTypes.string
};
DialogActions.defaultProps = {
  className: ""
};
export default DialogActions;