mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 18:29:11 +03:00
Fixed component
This commit is contained in:
parent
33da8ad1e6
commit
7ad90ffaeb
4
dist/public/js/bundle.js
vendored
4
dist/public/js/bundle.js
vendored
@ -3573,7 +3573,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InformationComponent\", function() { return InformationComponent; });\n/* harmony import */ var _core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/component */ \"./src/js/core/component.js\");\nfunction _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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\nvar InformationComponent =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(InformationComponent, _Component);\n\n function InformationComponent(id) {\n _classCallCheck(this, InformationComponent);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(InformationComponent).call(this, id));\n }\n\n _createClass(InformationComponent, [{\n key: \"init\",\n value: function init() {\n if (localStorage.getItem('visited')) {\n this.hide();\n }\n\n var btn = this.$el.querySelector('#information-close');\n btn.addEventListener('click', buttonHandler.bind(this));\n }\n }]);\n\n return InformationComponent;\n}(_core_component__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\nfunction buttonHandler() {\n localStorage.setItem('visited', JSON.stringify(true));\n this.hide();\n}\n\n//# sourceURL=webpack:///./src/js/components/information.component.js?");
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InformationComponent\", function() { return InformationComponent; });\n/* harmony import */ var _core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/component */ \"./src/js/core/component.js\");\nfunction _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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\nvar InformationComponent =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(InformationComponent, _Component);\n\n function InformationComponent(id) {\n _classCallCheck(this, InformationComponent);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(InformationComponent).call(this, id));\n }\n\n _createClass(InformationComponent, [{\n key: \"init\",\n value: function init() {\n if (this.$el) {\n if (localStorage.getItem('visited')) {\n this.hide();\n }\n\n var btn = this.$el.querySelector('#information-close');\n btn.addEventListener('click', buttonHandler.bind(this));\n }\n }\n }]);\n\n return InformationComponent;\n}(_core_component__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\nfunction buttonHandler() {\n localStorage.setItem('visited', JSON.stringify(true));\n this.hide();\n}\n\n//# sourceURL=webpack:///./src/js/components/information.component.js?");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@ -3585,7 +3585,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Component\", function() { return Component; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n function Component(id) {\n _classCallCheck(this, Component);\n\n this.$el = document.getElementById(id);\n this.init();\n }\n\n _createClass(Component, [{\n key: \"init\",\n value: function init() {}\n }, {\n key: \"hide\",\n value: function hide() {\n this.$el.classList.add('hide');\n }\n }, {\n key: \"show\",\n value: function show() {\n this.$el.classList.remove('hide');\n }\n }]);\n\n return Component;\n}();\n\n//# sourceURL=webpack:///./src/js/core/component.js?");
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Component\", function() { return Component; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n function Component(id) {\n _classCallCheck(this, Component);\n\n this.$el = document.getElementById(id);\n this.init();\n }\n\n _createClass(Component, [{\n key: \"init\",\n value: function init() {}\n }, {\n key: \"hide\",\n value: function hide() {\n this.$el ? this.$el.classList.add('hide') : false;\n }\n }, {\n key: \"show\",\n value: function show() {\n this.$el ? this.$el.classList.remove('hide') : false;\n }\n }]);\n\n return Component;\n}();\n\n//# sourceURL=webpack:///./src/js/core/component.js?");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
|||||||
@ -6,12 +6,14 @@ export class InformationComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
if (this.$el) {
|
||||||
if (localStorage.getItem('visited')) {
|
if (localStorage.getItem('visited')) {
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
const btn = this.$el.querySelector('#information-close');
|
const btn = this.$el.querySelector('#information-close');
|
||||||
btn.addEventListener('click', buttonHandler.bind(this));
|
btn.addEventListener('click', buttonHandler.bind(this));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonHandler() {
|
function buttonHandler() {
|
||||||
|
|||||||
@ -7,10 +7,10 @@ export class Component {
|
|||||||
init() {}
|
init() {}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
this.$el.classList.add('hide');
|
this.$el ? this.$el.classList.add('hide') : false
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
this.$el.classList.remove('hide')
|
this.$el ? this.$el.classList.remove('hide') : false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user