CarouselPanel.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 _modularityFront = _interopRequireDefault(require("modularity-front"));
  8. var _reactMaterialize = require("react-materialize");
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. 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); }
  11. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12. 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); } }
  13. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  14. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  15. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  16. 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); }
  17. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  18. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19. 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); }
  20. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  21. var Module = _modularityFront.default.Module;
  22. var CarouselPanelModule =
  23. /*#__PURE__*/
  24. function (_Modularity$Module) {
  25. _inherits(CarouselPanelModule, _Modularity$Module);
  26. function CarouselPanelModule(props) {
  27. var _this;
  28. _classCallCheck(this, CarouselPanelModule);
  29. _this = _possibleConstructorReturn(this, _getPrototypeOf(CarouselPanelModule).call(this, props));
  30. _this.state = {};
  31. return _this;
  32. }
  33. _createClass(CarouselPanelModule, [{
  34. key: "render",
  35. value: function render() {
  36. var panels = this.CarouselPanel.value.map(function (item) {
  37. return _react.default.createElement("div", {
  38. className: item.panelClass
  39. }, _react.default.createElement("h2", null, item.header), _react.default.createElement("p", {
  40. className: item.bodyClass
  41. }, item.body));
  42. });
  43. return _react.default.createElement(_reactMaterialize.Row, null, _react.default.createElement(_reactMaterialize.Col, {
  44. s: 12
  45. }, _react.default.createElement(_reactMaterialize.Carousel, {
  46. className: "carousel carousel-slider center",
  47. fixedItem: _react.default.createElement("div", {
  48. className: this.CarouselButton.value.position
  49. }, _react.default.createElement("a", {
  50. onClick: function onClick(e) {
  51. return console.log("clicked");
  52. },
  53. className: this.CarouselButton.value.style
  54. }, this.CarouselButton.value.content)),
  55. options: {
  56. fullWidth: this.CarouselOptions.value.fullWidth,
  57. indicators: this.CarouselOptions.value.indicators
  58. }
  59. }, panels), _get(_getPrototypeOf(CarouselPanelModule.prototype), "render", this).call(this)));
  60. }
  61. }]);
  62. return CarouselPanelModule;
  63. }(_modularityFront.default.Module);
  64. CarouselPanelModule.Inputs = {
  65. CarouselTitle: {
  66. type: Module.Types.Text,
  67. defaultValue: "Product Title"
  68. },
  69. CarouselPanel: {
  70. type: Module.Types.Array,
  71. defaultValue: [{
  72. header: "First Panel",
  73. body: "this is the first panel",
  74. panelClass: "red",
  75. bodyClass: "white-text"
  76. }, {
  77. header: "second Panel",
  78. body: "this is the second panel",
  79. panelClass: "amber",
  80. bodyClass: "white-text"
  81. }, {
  82. header: "third Panel",
  83. body: "this is the third panel",
  84. panelClass: "blue",
  85. bodyClass: "white-text"
  86. }],
  87. arrType: Module.Types.Object
  88. },
  89. CarouselOptions: {
  90. type: Module.Types.Object,
  91. defaultValue: {
  92. fullWidth: true,
  93. indicators: true
  94. }
  95. },
  96. CarouselImages: {
  97. type: Module.Types.Array,
  98. defaultValue: ["car1.jpg", "car2.jpg", "car3.jpg", "car4.jpg"],
  99. arrType: Module.Types.Text
  100. },
  101. CarouselButton: {
  102. type: Module.Types.Object,
  103. defaultValue: {
  104. position: "carousel-fixed-item center",
  105. style: "btn waves-effect white grey-text darken-text-2",
  106. content: "Click me"
  107. }
  108. }
  109. };
  110. CarouselPanelModule.Category = "sxoinas";
  111. var _default = CarouselPanelModule;
  112. exports.default = _default;