"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Sidebar = void 0;
var _react = _interopRequireDefault(require("react"));
var _Padder = require("./Padder");
var _Button = require("./Button");
var _reactRouterDom = require("react-router-dom");
var _reactFeather = require("react-feather");
var _IconButton = require("./IconButton");
require("../styles/sidebar.css");
var Sidebar = function Sidebar(_ref) {
  var sectionOne = _ref.sectionOne,
    sectionTwo = _ref.sectionTwo,
    icons = _ref.icons,
    width = _ref.width,
    logo = _ref.logo,
    title = _ref.title;
  var sidebarWidth = width > 150 ? width : 250;
  var sectionTwoItems = sectionTwo ? sectionTwo : [];
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "sticky-sidebar",
    style: {
      width: sidebarWidth
    }
  }, /*#__PURE__*/_react.default.createElement(_Padder.Padder, {
    top: "2em",
    left: "2.5em"
  }, logo ? /*#__PURE__*/_react.default.createElement("img", {
    style: {
      height: 38,
      paddingTop: 10
    },
    src: logo
  }) : /*#__PURE__*/_react.default.createElement("h4", null, title)), /*#__PURE__*/_react.default.createElement("div", {
    style: {
      overflowY: 'scroll',
      height: '70vh'
    }
  }, /*#__PURE__*/_react.default.createElement(_Padder.Padder, {
    top: "2em",
    left: "1.5em",
    right: "1.5em",
    bottom: "3em"
  }, sectionOne.map(function (item) {
    return /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
      to: item.link,
      style: {
        width: '100%'
      }
    }, /*#__PURE__*/_react.default.createElement(_Button.Button, {
      style: {
        marginBottom: '0.7em'
      },
      isActive: item.active,
      appearance: "minimal",
      align: "start",
      isFullWidth: true
    }, item.text));
  })), sectionTwoItems.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Padder.Padder, {
    left: "1.5em",
    right: "1.5em"
  }, /*#__PURE__*/_react.default.createElement("hr", null), sectionTwo.map(function (item) {
    return /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
      to: item.link,
      style: {
        width: '100%'
      }
    }, /*#__PURE__*/_react.default.createElement(_Button.Button, {
      style: {
        marginBottom: '0.7em'
      },
      isActive: item.active,
      appearance: "minimal",
      align: "start",
      isFullWidth: true
    }, item.text));
  })))), icons && icons.length > 0 && /*#__PURE__*/_react.default.createElement(_Padder.Padder, {
    left: "1.5em",
    right: "1.5em"
  }, /*#__PURE__*/_react.default.createElement("div", {
    style: {
      position: 'absolute',
      display: 'flex',
      bottom: 15
    }
  }, icons.map(function (icon) {
    if (icon.link) {
      return /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
        to: icon.link,
        style: {
          width: '100%'
        }
      }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
        style: {
          marginRight: '0.7em'
        },
        icon: icon.icon
      }));
    } else if (icon.action) {
      return /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
        style: {
          marginRight: '0.7em'
        },
        icon: icon.icon,
        onClick: icon.action
      });
    }
  }))));
};
exports.Sidebar = Sidebar;