mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +03:00
Added component Information
This commit is contained in:
parent
c99b101a7e
commit
33da8ad1e6
16
dist/public/js/bundle.js
vendored
16
dist/public/js/bundle.js
vendored
@ -3565,6 +3565,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/js/components/information.component.js":
|
||||
/*!****************************************************!*\
|
||||
!*** ./src/js/components/information.component.js ***!
|
||||
\****************************************************/
|
||||
/*! exports provided: InformationComponent */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"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?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/js/core/component.js":
|
||||
/*!**********************************!*\
|
||||
!*** ./src/js/core/component.js ***!
|
||||
@ -3573,7 +3585,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"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\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.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?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -3585,7 +3597,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_header_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/header.component */ \"./src/js/components/header.component.js\");\n\nnew _components_header_component__WEBPACK_IMPORTED_MODULE_0__[\"HeaderComponent\"]('header');\n\n//# sourceURL=webpack:///./src/js/index.js?");
|
||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_header_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/header.component */ \"./src/js/components/header.component.js\");\n/* harmony import */ var _components_information_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/information.component */ \"./src/js/components/information.component.js\");\n\n\nnew _components_header_component__WEBPACK_IMPORTED_MODULE_0__[\"HeaderComponent\"]('header');\nvar information = new _components_information_component__WEBPACK_IMPORTED_MODULE_1__[\"InformationComponent\"]('information');\n\n//# sourceURL=webpack:///./src/js/index.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
||||
2
dist/views/index.pug
vendored
2
dist/views/index.pug
vendored
@ -50,7 +50,7 @@ main.main-section
|
||||
| suscipit!
|
||||
| Minima.
|
||||
.information-close
|
||||
button.waves-effect.btn.red Закрыть
|
||||
button#information-close.waves-effect.btn.red Закрыть
|
||||
// Information Block END
|
||||
|
||||
// Category Block
|
||||
|
||||
20
src/js/components/information.component.js
Normal file
20
src/js/components/information.component.js
Normal file
@ -0,0 +1,20 @@
|
||||
import { Component } from "../core/component";
|
||||
|
||||
export class InformationComponent extends Component {
|
||||
constructor(id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
init() {
|
||||
if (localStorage.getItem('visited')) {
|
||||
this.hide();
|
||||
}
|
||||
const btn = this.$el.querySelector('#information-close');
|
||||
btn.addEventListener('click', buttonHandler.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
function buttonHandler() {
|
||||
localStorage.setItem('visited', JSON.stringify(true));
|
||||
this.hide();
|
||||
}
|
||||
@ -5,4 +5,12 @@ export class Component {
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
||||
hide() {
|
||||
this.$el.classList.add('hide');
|
||||
}
|
||||
|
||||
show() {
|
||||
this.$el.classList.remove('hide')
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,6 @@
|
||||
import { HeaderComponent } from "./components/header.component";
|
||||
import { InformationComponent } from "./components/information.component";
|
||||
|
||||
new HeaderComponent('header');
|
||||
new HeaderComponent('header');
|
||||
|
||||
const information = new InformationComponent('information');
|
||||
Loading…
x
Reference in New Issue
Block a user