function _extends() { _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; }; return _extends.apply(this, arguments); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from "react";
import classNames from "classnames";
import PropTypes from "prop-types";
import Icon from "react-oui-icons";
import Link from "../Link";
export var Navigation = function Navigation(_ref) {
  var className = _ref.className,
      helpUrl = _ref.helpUrl,
      homeUrl = _ref.homeUrl,
      logoUrl = _ref.logoUrl,
      _ref$onHelpClick = _ref.onHelpClick,
      onHelpClick = _ref$onHelpClick === void 0 ? function () {
    return null;
  } : _ref$onHelpClick,
      _ref$theme = _ref.theme,
      theme = _ref$theme === void 0 ? "dark" : _ref$theme,
      title = _ref.title,
      props = _objectWithoutProperties(_ref, ["className", "helpUrl", "homeUrl", "logoUrl", "onHelpClick", "theme", "title"]);

  var themeClass = "axiom-navigation--".concat(theme);
  var classes = classNames(_defineProperty({
    "axiom-navigation": true,
    "flex": true,
    "flex-align--center": true
  }, themeClass, true), className);

  var onAppRouteLinkClick = function onAppRouteLinkClick(event) {
    return onHelpClick(event, helpUrl);
  };

  return React.createElement("nav", _extends({
    className: classes,
    "data-test-section": "navigation"
  }, props), React.createElement("div", {
    className: "axiom-navigation__brand soft-double--right flex flex-align--center flex-shrink--none"
  }, logoUrl && React.createElement("div", {
    className: "axiom-navigation__logo"
  }, React.createElement(Link, {
    href: homeUrl,
    testSection: "navigation--brand-logo"
  }, React.createElement("img", {
    alt: "logo",
    src: logoUrl,
    className: "push--right axiom-navigation__logo--mark"
  }))), title && React.createElement("div", {
    className: "axiom-navigation__title"
  }, title)), React.createElement("div", {
    className: "axiom-navigation__actions push-double--right flex flex-align--center flex-shrink--none"
  }, helpUrl && React.createElement(Link, {
    className: "flex flex-align--center",
    href: helpUrl,
    onClick: onAppRouteLinkClick,
    testSection: "navigation--help-icon"
  }, React.createElement(Icon, {
    description: "center",
    name: "help",
    fill: theme === "dark" ? "white" : "black",
    size: "large",
    style: {
      alignSelf: "center"
    }
  }))));
};
Navigation.propTypes = {
  className: PropTypes.string,
  helpUrl: PropTypes.string,
  homeUrl: PropTypes.string,
  logoUrl: PropTypes.string,
  onHelpClick: PropTypes.func,
  theme: PropTypes.oneOf(["dark", "light"]),
  title: PropTypes.string.isRequired
};