Navbar.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. var _Module2 = _interopRequireDefault(require("../Module"));
  8. var _User = _interopRequireDefault(require("../../systems/services/User"));
  9. var _Link = _interopRequireDefault(require("./Link.js"));
  10. require("./Navbar.css");
  11. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  13. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  16. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  17. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  18. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  19. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  20. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  21. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  22. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  23. var Navbar =
  24. /*#__PURE__*/
  25. function (_Module) {
  26. _inherits(Navbar, _Module);
  27. function Navbar(props) {
  28. var _this;
  29. _classCallCheck(this, Navbar);
  30. _this = _possibleConstructorReturn(this, _getPrototypeOf(Navbar).call(this, props));
  31. _this.state = {};
  32. return _this;
  33. }
  34. _createClass(Navbar, [{
  35. key: "render",
  36. value: function render() {
  37. var _this2 = this;
  38. // </div>;
  39. return _react.default.createElement("nav", {
  40. className: "navbar navbar-expand-md navbar-dark bg-dark"
  41. }, _react.default.createElement("a", {
  42. className: "navbar-brand",
  43. href: "#"
  44. }, _react.default.createElement("img", {
  45. src: this.logo.value,
  46. width: "30",
  47. height: "30",
  48. className: "d-inline-block align-top",
  49. alt: ""
  50. }), this.brand.value), _react.default.createElement("button", {
  51. className: "navbar-toggler",
  52. type: "button",
  53. "data-toggle": "collapse",
  54. "data-target": "#NAVID",
  55. "aria-controls": "NAVID",
  56. "aria-expanded": "false",
  57. "aria-label": "Toggle navigation"
  58. }, _react.default.createElement("span", {
  59. className: "navbar-toggler-icon"
  60. })), _react.default.createElement("div", {
  61. className: "collapse navbar-collapse",
  62. id: "NAVID"
  63. }, _react.default.createElement("ul", {
  64. className: "navbar-nav"
  65. }, (this.headers.value || []).map(function (item, index) {
  66. return _react.default.createElement("li", {
  67. className: "nav-item active",
  68. key: index
  69. }, _react.default.createElement(_Link.default, {
  70. link: _this2.links.value[index],
  71. className: "nav-link"
  72. }, item));
  73. }))), _get(_getPrototypeOf(Navbar.prototype), "render", this).call(this, true));
  74. }
  75. }]);
  76. return Navbar;
  77. }(_Module2.default);
  78. Navbar.EditPosition = "top-right";
  79. Navbar.Inputs = {
  80. logo: {
  81. type: _Module2.default.Types.Text,
  82. defaultValue: '/logo.png'
  83. },
  84. brand: {
  85. type: _Module2.default.Types.Text,
  86. defaultValue: 'Bootstrap'
  87. },
  88. headers: {
  89. type: _Module2.default.Types.Array,
  90. defaultValue: ['Home', 'Test', 'Contact'],
  91. arrType: _Module2.default.Types.Text
  92. },
  93. links: {
  94. type: _Module2.default.Types.Array,
  95. defaultValue: ['home', 'test', 'contact'],
  96. arrType: _Module2.default.Types.Text
  97. }
  98. };
  99. Navbar.Category = "Layout";
  100. var _default = Navbar;
  101. exports.default = _default;