"use strict";

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

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

var _reactRedux = require("react-redux");

var _sidebarBranding = _interopRequireDefault(require("./sidebar-branding"));

var _sidebarParent = _interopRequireDefault(require("./sidebar-parent"));

var _sidebarPages = _interopRequireDefault(require("./sidebar-pages"));

var _groupResources = _interopRequireDefault(require("./utils/group-resources"));

var _designSystem = require("../../design-system");

var _sidebarFooter = _interopRequireDefault(require("./sidebar-footer"));

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

const Sidebar = props => {
  const {
    branding,
    resources,
    pages
  } = props;
  return _react.default.createElement(_designSystem.Navigation, null, _react.default.createElement(_designSystem.Box, {
    flexShrink: 0,
    px: "lg",
    pb: "xxl"
  }, _react.default.createElement(_sidebarBranding.default, {
    branding: branding
  })), _react.default.createElement(_designSystem.Box, {
    flexGrow: 1
  }, _react.default.createElement(_designSystem.Label, {
    uppercase: true,
    ml: "lg",
    color: "grey"
  }, "Navigation"), (0, _groupResources.default)(resources).map(parent => _react.default.createElement(_sidebarParent.default, {
    parent: parent,
    key: parent.name
  }))), _react.default.createElement(_sidebarPages.default, {
    pages: pages
  }), branding.softwareBrothers && _react.default.createElement(_sidebarFooter.default, null));
};

const mapStateToProps = state => ({
  resources: state.resources,
  branding: state.branding,
  pages: state.pages
});

var _default = (0, _reactRedux.connect)(mapStateToProps)(Sidebar);

exports.default = _default;