您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

500 行
16 KiB

  1. (function() {
  2. var exports = {};
  3. exports.id = 2888;
  4. exports.ids = [2888];
  5. exports.modules = {
  6. /***/ 2706:
  7. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  8. "use strict";
  9. // ESM COMPAT FLAG
  10. __webpack_require__.r(__webpack_exports__);
  11. // EXPORTS
  12. __webpack_require__.d(__webpack_exports__, {
  13. "default": function() { return /* binding */ App; }
  14. });
  15. // EXTERNAL MODULE: external "react/jsx-runtime"
  16. var jsx_runtime_ = __webpack_require__(5282);
  17. // EXTERNAL MODULE: external "react"
  18. var external_react_ = __webpack_require__(9297);
  19. var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
  20. ;// CONCATENATED MODULE: external "next/head"
  21. var head_namespaceObject = require("next/head");;
  22. var head_default = /*#__PURE__*/__webpack_require__.n(head_namespaceObject);
  23. // EXTERNAL MODULE: external "react-feather"
  24. var external_react_feather_ = __webpack_require__(9337);
  25. ;// CONCATENATED MODULE: ./components/_App/GoTop.js
  26. const GoTop = ({
  27. scrollStepInPx,
  28. delayInMs
  29. }) => {
  30. const [thePosition, setThePosition] = external_react_default().useState(false);
  31. const timeoutRef = external_react_default().useRef(null);
  32. external_react_default().useEffect(() => {
  33. document.addEventListener("scroll", () => {
  34. if (window.scrollY > 170) {
  35. setThePosition(true);
  36. } else {
  37. setThePosition(false);
  38. }
  39. });
  40. }, []);
  41. const onScrollStep = () => {
  42. if (window.pageYOffset === 0) {
  43. clearInterval(timeoutRef.current);
  44. }
  45. window.scroll(0, window.pageYOffset - scrollStepInPx);
  46. };
  47. const scrollToTop = () => {
  48. timeoutRef.current = setInterval(onScrollStep, delayInMs);
  49. };
  50. const renderGoTopIcon = () => {
  51. return /*#__PURE__*/jsx_runtime_.jsx("div", {
  52. className: `go-top ${thePosition ? 'active' : ''}`,
  53. onClick: scrollToTop,
  54. children: /*#__PURE__*/jsx_runtime_.jsx(external_react_feather_.ArrowUp, {})
  55. });
  56. };
  57. return /*#__PURE__*/jsx_runtime_.jsx((external_react_default()).Fragment, {
  58. children: renderGoTopIcon()
  59. });
  60. };
  61. /* harmony default export */ var _App_GoTop = (GoTop);
  62. ;// CONCATENATED MODULE: ./components/_App/Layout.js
  63. const Layout = ({
  64. children
  65. }) => {
  66. return /*#__PURE__*/(0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
  67. children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)((head_default()), {
  68. children: [/*#__PURE__*/jsx_runtime_.jsx("meta", {
  69. charSet: "utf-8"
  70. }), /*#__PURE__*/jsx_runtime_.jsx("meta", {
  71. name: "viewport",
  72. content: "width=device-width, initial-scale=1"
  73. }), /*#__PURE__*/jsx_runtime_.jsx("title", {
  74. children: "Thamrin Group"
  75. })]
  76. }), children, /*#__PURE__*/jsx_runtime_.jsx(_App_GoTop, {
  77. scrollStepInPx: "100",
  78. delayInMs: "10.50"
  79. })]
  80. });
  81. };
  82. /* harmony default export */ var _App_Layout = (Layout);
  83. // EXTERNAL MODULE: external "react-redux"
  84. var external_react_redux_ = __webpack_require__(79);
  85. // EXTERNAL MODULE: external "react-toast-notifications"
  86. var external_react_toast_notifications_ = __webpack_require__(9614);
  87. ;// CONCATENATED MODULE: external "redux"
  88. var external_redux_namespaceObject = require("redux");;
  89. ;// CONCATENATED MODULE: external "redux-devtools-extension"
  90. var external_redux_devtools_extension_namespaceObject = require("redux-devtools-extension");;
  91. ;// CONCATENATED MODULE: ./products.js
  92. const productsData = [{
  93. id: 'wood-pencil',
  94. name: 'Wood Pencil',
  95. price: 19.99,
  96. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  97. availability: 'In Stock',
  98. image: '/images/shop-image/shop-image1.jpg',
  99. images: [{
  100. id: 1,
  101. img: '/images/shop-image/shop-image1.jpg'
  102. }, {
  103. id: 2,
  104. img: '/images/shop-image/shop-image1.jpg'
  105. }, {
  106. id: 3,
  107. img: '/images/shop-image/shop-image1.jpg'
  108. }, {
  109. id: 4,
  110. img: '/images/shop-image/shop-image1.jpg'
  111. }]
  112. }, {
  113. id: 't-shirt',
  114. name: 'T-Shirt',
  115. price: 22.99,
  116. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  117. availability: 'In Stock',
  118. image: '/images/shop-image/shop-image2.jpg',
  119. images: [{
  120. id: 1,
  121. img: '/images/shop-image/shop-image1.jpg'
  122. }, {
  123. id: 2,
  124. img: '/images/shop-image/shop-image2.jpg'
  125. }, {
  126. id: 3,
  127. img: '/images/shop-image/shop-image1.jpg'
  128. }, {
  129. id: 4,
  130. img: '/images/shop-image/shop-image2.jpg'
  131. }]
  132. }, {
  133. id: 'casual-shoe',
  134. name: 'Casual Shoe',
  135. price: 31.99,
  136. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  137. availability: 'In Stock',
  138. image: '/images/shop-image/shop-image3.jpg',
  139. images: [{
  140. id: 1,
  141. img: '/images/shop-image/shop-image3.jpg'
  142. }, {
  143. id: 2,
  144. img: '/images/shop-image/shop-image2.jpg'
  145. }, {
  146. id: 3,
  147. img: '/images/shop-image/shop-image1.jpg'
  148. }, {
  149. id: 4,
  150. img: '/images/shop-image/shop-image2.jpg'
  151. }]
  152. }, {
  153. id: 'coffee-bag',
  154. name: 'Coffee Bag',
  155. price: 4.99,
  156. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  157. availability: 'In Stock',
  158. image: '/images/shop-image/shop-image4.jpg',
  159. images: [{
  160. id: 1,
  161. img: '/images/shop-image/shop-image4.jpg'
  162. }, {
  163. id: 2,
  164. img: '/images/shop-image/shop-image2.jpg'
  165. }, {
  166. id: 3,
  167. img: '/images/shop-image/shop-image1.jpg'
  168. }, {
  169. id: 4,
  170. img: '/images/shop-image/shop-image4.jpg'
  171. }]
  172. }, {
  173. id: 'single-chair',
  174. name: 'Single Chair',
  175. price: 149.99,
  176. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  177. availability: 'In Stock',
  178. image: '/images/shop-image/shop-image5.jpg',
  179. images: [{
  180. id: 1,
  181. img: '/images/shop-image/shop-image5.jpg'
  182. }, {
  183. id: 2,
  184. img: '/images/shop-image/shop-image2.jpg'
  185. }, {
  186. id: 3,
  187. img: '/images/shop-image/shop-image1.jpg'
  188. }, {
  189. id: 4,
  190. img: '/images/shop-image/shop-image4.jpg'
  191. }]
  192. }, {
  193. id: 'business-card',
  194. name: 'Business Card',
  195. price: 1.99,
  196. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  197. availability: 'In Stock',
  198. image: '/images/shop-image/shop-image6.jpg',
  199. images: [{
  200. id: 1,
  201. img: '/images/shop-image/shop-image6.jpg'
  202. }, {
  203. id: 2,
  204. img: '/images/shop-image/shop-image2.jpg'
  205. }, {
  206. id: 3,
  207. img: '/images/shop-image/shop-image1.jpg'
  208. }, {
  209. id: 4,
  210. img: '/images/shop-image/shop-image4.jpg'
  211. }]
  212. }, {
  213. id: 'book-cover',
  214. name: 'Book Cover',
  215. price: 3.99,
  216. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  217. availability: 'In Stock',
  218. image: '/images/shop-image/shop-image7.jpg',
  219. images: [{
  220. id: 1,
  221. img: '/images/shop-image/shop-image7.jpg'
  222. }, {
  223. id: 2,
  224. img: '/images/shop-image/shop-image2.jpg'
  225. }, {
  226. id: 3,
  227. img: '/images/shop-image/shop-image1.jpg'
  228. }, {
  229. id: 4,
  230. img: '/images/shop-image/shop-image4.jpg'
  231. }]
  232. }, {
  233. id: 'wall-watch',
  234. name: 'Wall Watch',
  235. price: 9.99,
  236. desc: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.",
  237. availability: 'In Stock',
  238. image: '/images/shop-image/shop-image8.jpg',
  239. images: [{
  240. id: 1,
  241. img: '/images/shop-image/shop-image8.jpg'
  242. }, {
  243. id: 2,
  244. img: '/images/shop-image/shop-image2.jpg'
  245. }, {
  246. id: 3,
  247. img: '/images/shop-image/shop-image1.jpg'
  248. }, {
  249. id: 4,
  250. img: '/images/shop-image/shop-image4.jpg'
  251. }]
  252. }];
  253. ;// CONCATENATED MODULE: ./store.js
  254. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  255. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  256. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  257. let store;
  258. const initialState = {
  259. products: productsData,
  260. cart: [],
  261. total: 0
  262. };
  263. const reducer = (state = initialState, action) => {
  264. switch (action.type) {
  265. case 'ADD_TO_CART':
  266. let addedItem = state.products.find(item => item.id === action.id);
  267. let existed_item = state.cart.find(item => action.id === item.id);
  268. if (existed_item) {
  269. addedItem.quantity += 1;
  270. return _objectSpread(_objectSpread({}, state), {}, {
  271. total: state.total + addedItem.price
  272. });
  273. } else {
  274. addedItem.quantity = 1;
  275. let newTotal = state.total + addedItem.price;
  276. return _objectSpread(_objectSpread({}, state), {}, {
  277. cart: [...state.cart, addedItem],
  278. total: newTotal
  279. });
  280. }
  281. case 'ADD_QUANTITY':
  282. let existingItem = state.cart.find(item => item.id === action.id);
  283. existingItem.quantity += 1;
  284. let newTotal = state.total + existingItem.price;
  285. return _objectSpread(_objectSpread({}, state), {}, {
  286. total: newTotal
  287. });
  288. case 'SUB_QUANTITY':
  289. let exItem = state.products.find(item => item.id === action.id);
  290. if (exItem.quantity === 1) {
  291. let new_items = state.cart.filter(item => item.id !== action.id);
  292. let newTotal = state.total - exItem.price;
  293. return _objectSpread(_objectSpread({}, state), {}, {
  294. cart: new_items,
  295. total: newTotal
  296. });
  297. } else {
  298. exItem.quantity -= 1;
  299. let newTotal = state.total - exItem.price;
  300. return _objectSpread(_objectSpread({}, state), {}, {
  301. total: newTotal
  302. });
  303. }
  304. case 'ADD_QUANTITY_WITH_NUMBER':
  305. let addedItemD = state.products.find(item => item.id === action.id); //check if the action id exists in the addedItems
  306. let existed_itemd = state.cart.find(item => action.id === item.id);
  307. if (existed_itemd) {
  308. addeaddedItemDdItem.quantity += action.qty;
  309. return _objectSpread(_objectSpread({}, state), {}, {
  310. total: state.total + addedItemD.price * action.qty
  311. });
  312. } else {
  313. addedItemD.quantity = action.qty; //calculating the total
  314. let newTotal = state.total + addedItemD.price * action.qty;
  315. return _objectSpread(_objectSpread({}, state), {}, {
  316. cart: [...state.cart, addedItemD],
  317. total: newTotal
  318. });
  319. }
  320. case 'REMOVE_ITEM':
  321. let itemToRemove = state.cart.find(item => action.id === item.id);
  322. let new_items = state.cart.filter(item => action.id !== item.id); //calculating the total
  323. let newTotalRemove = state.total - itemToRemove.price * itemToRemove.quantity;
  324. return _objectSpread(_objectSpread({}, state), {}, {
  325. cart: new_items,
  326. total: newTotalRemove
  327. });
  328. case 'RESET':
  329. return _objectSpread(_objectSpread({}, state), {}, {
  330. cart: []
  331. });
  332. default:
  333. return state;
  334. }
  335. };
  336. function initStore(preloadedState = initialState) {
  337. return (0,external_redux_namespaceObject.createStore)(reducer, preloadedState, (0,external_redux_devtools_extension_namespaceObject.composeWithDevTools)((0,external_redux_namespaceObject.applyMiddleware)()));
  338. }
  339. const initializeStore = preloadedState => {
  340. var _store2;
  341. let _store = (_store2 = store) !== null && _store2 !== void 0 ? _store2 : initStore(preloadedState); // After navigating to a page with an initial Redux state, merge that state
  342. // with the current state in the store, and create a new store
  343. if (preloadedState && store) {
  344. _store = initStore(_objectSpread(_objectSpread({}, store.getState()), preloadedState)); // Reset the current store
  345. store = undefined;
  346. } // For SSG and SSR always create a new store
  347. if (true) return _store; // Create the store once in the client
  348. if (!store) store = _store;
  349. return _store;
  350. };
  351. function useStore(initialState) {
  352. const store = (0,external_react_.useMemo)(() => initializeStore(initialState), [initialState]);
  353. return store;
  354. }
  355. ;// CONCATENATED MODULE: ./pages/_app.js
  356. function _app_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  357. function _app_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { _app_ownKeys(Object(source), true).forEach(function (key) { _app_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { _app_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  358. function _app_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  359. // Multicolor if you want this color comment out
  360. // import '@/public/css/colors/brink-pink-style.css'
  361. // import '@/public/css/colors/pink-style.css'
  362. // import '@/public/css/colors/purple-style.css'
  363. function App({
  364. Component,
  365. pageProps
  366. }) {
  367. const store = useStore(pageProps.initialReduxState);
  368. return /*#__PURE__*/jsx_runtime_.jsx(external_react_toast_notifications_.ToastProvider, {
  369. placement: "bottom-left",
  370. autoDismissTimeout: 6000,
  371. autoDismiss: true,
  372. children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(external_react_redux_.Provider, {
  373. store: store,
  374. children: [/*#__PURE__*/jsx_runtime_.jsx(_App_Layout, {}), /*#__PURE__*/jsx_runtime_.jsx(Component, _app_objectSpread({}, pageProps))]
  375. })
  376. });
  377. }
  378. /***/ }),
  379. /***/ 9297:
  380. /***/ (function(module) {
  381. "use strict";
  382. module.exports = require("react");;
  383. /***/ }),
  384. /***/ 9337:
  385. /***/ (function(module) {
  386. "use strict";
  387. module.exports = require("react-feather");;
  388. /***/ }),
  389. /***/ 79:
  390. /***/ (function(module) {
  391. "use strict";
  392. module.exports = require("react-redux");;
  393. /***/ }),
  394. /***/ 9614:
  395. /***/ (function(module) {
  396. "use strict";
  397. module.exports = require("react-toast-notifications");;
  398. /***/ }),
  399. /***/ 5282:
  400. /***/ (function(module) {
  401. "use strict";
  402. module.exports = require("react/jsx-runtime");;
  403. /***/ })
  404. };
  405. ;
  406. // load runtime
  407. var __webpack_require__ = require("../webpack-runtime.js");
  408. __webpack_require__.C(exports);
  409. var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  410. var __webpack_exports__ = (__webpack_exec__(2706));
  411. module.exports = __webpack_exports__;
  412. })();