HorizontalCard.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  17. 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); }
  18. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19. var Module = _modularityFront.default.Module;
  20. var HorizontalCard =
  21. /*#__PURE__*/
  22. function (_Modularity$Module) {
  23. _inherits(HorizontalCard, _Modularity$Module);
  24. function HorizontalCard(props) {
  25. _classCallCheck(this, HorizontalCard);
  26. return _possibleConstructorReturn(this, _getPrototypeOf(HorizontalCard).call(this, props));
  27. }
  28. _createClass(HorizontalCard, [{
  29. key: "addProd",
  30. value: function addProd(e) {
  31. e.preventDefault();
  32. var prod = {
  33. id: this.props.id,
  34. name: this.CardTitle.value,
  35. price: this.Price.value,
  36. quantity: 1
  37. };
  38. this.product.set(prod);
  39. }
  40. }, {
  41. key: "render",
  42. value: function render() {
  43. var CardButton = this.CardButton.value;
  44. return _react.default.createElement(_reactMaterialize.Row, null, _react.default.createElement(_reactMaterialize.Col, {
  45. m: 6,
  46. s: 12
  47. }, _react.default.createElement(_reactMaterialize.Card, {
  48. horizontal: true,
  49. header: _react.default.createElement(_reactMaterialize.CardTitle, {
  50. image: '/card.jpg'
  51. }),
  52. actions: [_react.default.createElement("a", null)]
  53. }, "Here is the standard card with a horizontal image.")));
  54. }
  55. }]);
  56. return HorizontalCard;
  57. }(_modularityFront.default.Module);
  58. HorizontalCard.Inputs = {
  59. CardTitle: {
  60. type: Module.Types.Text,
  61. defaultValue: "Some test title"
  62. },
  63. CardBody: {
  64. type: Module.Types.Text,
  65. defaultValue: "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively."
  66. },
  67. CardImage: {
  68. type: Module.Types.Text,
  69. defaultValue: "/card.jpg"
  70. },
  71. Price: {
  72. type: Module.Types.Number,
  73. defaultValue: 12
  74. },
  75. CardButton: {
  76. //should be boolean if we have just add
  77. type: Module.Types.Text,
  78. defaultValue: true
  79. }
  80. };
  81. HorizontalCard.Outputs = {
  82. product: {}
  83. };
  84. HorizontalCard.Category = "sxoinas";
  85. var _default = HorizontalCard;
  86. exports.default = _default;