import { ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeft16BoldBlueIcon } from '@cloudtower/icons-react';
import { cx } from '@linaria/core';
import Icon from '../../core/Icon/index.js';
import { Typo } from '../../core/Typo/index.js';
import React__default from 'react';

const GobackButtonStyle = "E_gmyahx3";
const GobackButton = props => {
  const {
    onClick,
    path,
    index,
    title,
    history
  } = props;
  const goto = () => {
    if (path) {
      history.push(path);
      return;
    }
    if (index) {
      history.go(index);
      return;
    }
    if (onClick) {
      onClick == null ? void 0 : onClick();
      return;
    }
    history.goBack();
  };
  return /* @__PURE__ */React__default.createElement("span", {
    className: cx(GobackButtonStyle)
  }, /* @__PURE__ */React__default.createElement(Icon, {
    src: ArrowChevronLeft16BoldTertiaryIcon,
    hoverSrc: ArrowChevronLeft16BoldBlueIcon,
    onClick: goto
  }, /* @__PURE__ */React__default.createElement("span", {
    className: cx(Typo.Label.l4_bold, "link-text")
  }, title)));
};
var GoBackButton = GobackButton;

export { GoBackButton as default };
