s-platform-landing-section 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -214,7 +214,7 @@ var Options = function Options(props) {
214
214
  };
215
215
 
216
216
  var NavBar7 = function NavBar7(props) {
217
- var _routes$find, _routes$filter, _routes$filter2;
217
+ var _routes$find, _shopConfigStyle$navB, _shopConfigStyle$navB2, _shopConfigStyle$navB3, _shopConfigStyle$navB4;
218
218
  var _useState = React.useState(false),
219
219
  isOpen = _useState[0],
220
220
  setIsOpen = _useState[1];
@@ -260,17 +260,6 @@ var NavBar7 = function NavBar7(props) {
260
260
  className: "text-gray3"
261
261
  })
262
262
  }];
263
- React.useEffect(function () {
264
- if ((shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "cafe_1" || (shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "grocery_1" || (shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "fashion_1") {
265
- routes === null || routes === void 0 ? void 0 : routes.forEach(function (route) {
266
- if ((route === null || route === void 0 ? void 0 : route.name) === "home" || (route === null || route === void 0 ? void 0 : route.name) === "products" || (route === null || route === void 0 ? void 0 : route.name) === "about") {
267
- route.isShow = true;
268
- } else {
269
- route.isShow = false;
270
- }
271
- });
272
- }
273
- }, [shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode]);
274
263
  React.useEffect(function () {
275
264
  var totalItem = cartItems === null || cartItems === void 0 ? void 0 : cartItems.reduce(function (total, item) {
276
265
  return total + (item === null || item === void 0 ? void 0 : item.quantity);
@@ -309,15 +298,15 @@ var NavBar7 = function NavBar7(props) {
309
298
  className: "text-xl md:text-2xl whitespace-nowrap font-semibold text-primary"
310
299
  }, shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopName)), /*#__PURE__*/React__default.createElement("div", {
311
300
  className: "hidden lg:flex flex-1 items-center gap-4"
312
- }, routes === null || routes === void 0 ? void 0 : (_routes$filter = routes.filter(function (e) {
301
+ }, shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : (_shopConfigStyle$navB = shopConfigStyle.navBarMenus) === null || _shopConfigStyle$navB === void 0 ? void 0 : (_shopConfigStyle$navB2 = _shopConfigStyle$navB.filter(function (e) {
313
302
  return e === null || e === void 0 ? void 0 : e.isShow;
314
- })) === null || _routes$filter === void 0 ? void 0 : _routes$filter.map(function (item, index) {
303
+ })) === null || _shopConfigStyle$navB2 === void 0 ? void 0 : _shopConfigStyle$navB2.map(function (item, index) {
315
304
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
316
305
  Link: Link,
317
306
  href: item === null || item === void 0 ? void 0 : item.route,
318
307
  key: index
319
308
  }, (item === null || item === void 0 ? void 0 : item.name) === (route === null || route === void 0 ? void 0 : route.name) ? /*#__PURE__*/React__default.createElement("div", {
320
- className: "py-1 border-b text-textHeading border-textHeading"
309
+ className: "whitespace-nowrap py-1 border-b text-textHeading border-textHeading"
321
310
  }, item === null || item === void 0 ? void 0 : item.label) : /*#__PURE__*/React__default.createElement("div", {
322
311
  className: "py-1 text-textBody"
323
312
  }, item === null || item === void 0 ? void 0 : item.label));
@@ -394,9 +383,9 @@ var NavBar7 = function NavBar7(props) {
394
383
  }
395
384
  }, /*#__PURE__*/React__default.createElement(rx.RxCross2, {
396
385
  size: 24
397
- })), /*#__PURE__*/React__default.createElement("div", null, routes === null || routes === void 0 ? void 0 : (_routes$filter2 = routes.filter(function (e) {
386
+ })), /*#__PURE__*/React__default.createElement("div", null, shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : (_shopConfigStyle$navB3 = shopConfigStyle.navBarMenus) === null || _shopConfigStyle$navB3 === void 0 ? void 0 : (_shopConfigStyle$navB4 = _shopConfigStyle$navB3.filter(function (e) {
398
387
  return e === null || e === void 0 ? void 0 : e.isShow;
399
- })) === null || _routes$filter2 === void 0 ? void 0 : _routes$filter2.map(function (item, index) {
388
+ })) === null || _shopConfigStyle$navB4 === void 0 ? void 0 : _shopConfigStyle$navB4.map(function (item, index) {
400
389
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
401
390
  Link: Link,
402
391
  href: item === null || item === void 0 ? void 0 : item.route,
@@ -408,7 +397,7 @@ var NavBar7 = function NavBar7(props) {
408
397
  };
409
398
 
410
399
  var NavBar1 = function NavBar1(props) {
411
- var _routes$find, _routes$filter, _routes$filter2;
400
+ var _routes$find, _shopConfigStyle$navB, _shopConfigStyle$navB2, _shopConfigStyle$navB3, _shopConfigStyle$navB4;
412
401
  var _useState = React.useState(false),
413
402
  isOpen = _useState[0],
414
403
  setIsOpen = _useState[1];
@@ -454,17 +443,6 @@ var NavBar1 = function NavBar1(props) {
454
443
  className: "text-gray3"
455
444
  })
456
445
  }];
457
- React.useEffect(function () {
458
- if ((shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "cafe_1" || (shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "grocery_1" || (shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === "fashion_1") {
459
- routes === null || routes === void 0 ? void 0 : routes.forEach(function (route) {
460
- if ((route === null || route === void 0 ? void 0 : route.name) === "home" || (route === null || route === void 0 ? void 0 : route.name) === "products" || (route === null || route === void 0 ? void 0 : route.name) === "about") {
461
- route.isShow = true;
462
- } else {
463
- route.isShow = false;
464
- }
465
- });
466
- }
467
- }, [shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode]);
468
446
  React.useEffect(function () {
469
447
  var totalItem = cartItems === null || cartItems === void 0 ? void 0 : cartItems.reduce(function (total, item) {
470
448
  return total + (item === null || item === void 0 ? void 0 : item.quantity);
@@ -522,15 +500,15 @@ var NavBar1 = function NavBar1(props) {
522
500
  className: "text-xl md:text-2xl whitespace-nowrap font-semibold text-primary"
523
501
  }, shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopName)), /*#__PURE__*/React__default.createElement("div", {
524
502
  className: "hidden lg:flex flex-1 items-center gap-4"
525
- }, routes === null || routes === void 0 ? void 0 : (_routes$filter = routes.filter(function (e) {
503
+ }, shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : (_shopConfigStyle$navB = shopConfigStyle.navBarMenus) === null || _shopConfigStyle$navB === void 0 ? void 0 : (_shopConfigStyle$navB2 = _shopConfigStyle$navB.filter(function (e) {
526
504
  return e === null || e === void 0 ? void 0 : e.isShow;
527
- })) === null || _routes$filter === void 0 ? void 0 : _routes$filter.map(function (item, index) {
505
+ })) === null || _shopConfigStyle$navB2 === void 0 ? void 0 : _shopConfigStyle$navB2.map(function (item, index) {
528
506
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
529
507
  Link: Link,
530
508
  href: item === null || item === void 0 ? void 0 : item.route,
531
509
  key: index
532
510
  }, /*#__PURE__*/React__default.createElement("div", {
533
- className: "py-1 " + ((item === null || item === void 0 ? void 0 : item.name) === (route === null || route === void 0 ? void 0 : route.name) ? "border-b text-primary border-primary" : "text-textBody") + " "
511
+ className: "py-1 whitespace-nowrap " + ((item === null || item === void 0 ? void 0 : item.name) === (route === null || route === void 0 ? void 0 : route.name) ? "border-b text-primary border-primary" : "text-textBody") + " "
534
512
  }, item === null || item === void 0 ? void 0 : item.label));
535
513
  })), cart(), userInfo ?
536
514
  /*#__PURE__*/
@@ -614,9 +592,9 @@ var NavBar1 = function NavBar1(props) {
614
592
  }
615
593
  }, /*#__PURE__*/React__default.createElement(rx.RxCross2, {
616
594
  size: 24
617
- }))), /*#__PURE__*/React__default.createElement("div", null, routes === null || routes === void 0 ? void 0 : (_routes$filter2 = routes.filter(function (e) {
595
+ }))), /*#__PURE__*/React__default.createElement("div", null, shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : (_shopConfigStyle$navB3 = shopConfigStyle.navBarMenus) === null || _shopConfigStyle$navB3 === void 0 ? void 0 : (_shopConfigStyle$navB4 = _shopConfigStyle$navB3.filter(function (e) {
618
596
  return e === null || e === void 0 ? void 0 : e.isShow;
619
- })) === null || _routes$filter2 === void 0 ? void 0 : _routes$filter2.map(function (item, index) {
597
+ })) === null || _shopConfigStyle$navB4 === void 0 ? void 0 : _shopConfigStyle$navB4.map(function (item, index) {
620
598
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
621
599
  Link: Link,
622
600
  href: item === null || item === void 0 ? void 0 : item.route,
@@ -870,7 +848,7 @@ var Hero1 = function Hero1(props) {
870
848
  }, /*#__PURE__*/React__default.createElement("div", {
871
849
  className: "w-[80%] md:w-2/3 xl:w-1/2 md:h-2/3 flex flex-col gap-2 md:gap-8 justify-center items-center bg-background opacity-90 absolute top-5 md:top-10 px-6 py-4 rounded-tr-[40px] rounded-bl-[40px] md:rounded-tr-[80px] md:rounded-bl-[80px]"
872
850
  }, /*#__PURE__*/React__default.createElement("div", {
873
- className: "text-xl md:text-4xl lg:text-[40px] text-primary font-medium"
851
+ className: "text-xl text-center md:text-4xl lg:text-[40px] text-primary font-medium"
874
852
  }, sectionData === null || sectionData === void 0 ? void 0 : (_sectionData$2 = sectionData[0]) === null || _sectionData$2 === void 0 ? void 0 : _sectionData$2.title), /*#__PURE__*/React__default.createElement("div", {
875
853
  className: "text-center md:text-2xl lg:text-3xl font-medium"
876
854
  }, sectionData === null || sectionData === void 0 ? void 0 : (_sectionData$3 = sectionData[0]) === null || _sectionData$3 === void 0 ? void 0 : _sectionData$3.description), /*#__PURE__*/React__default.createElement(LinkToPage, {
@@ -1064,7 +1042,7 @@ var CarouselItem = function CarouselItem(props) {
1064
1042
  }, /*#__PURE__*/React__default.createElement("div", {
1065
1043
  className: "col-span-12 lg:col-span-10 md:col-span-9 overflow-hidden "
1066
1044
  }, /*#__PURE__*/React__default.createElement("div", {
1067
- className: "flex overflow-x-auto gap-2 hide-scrollbar items-center",
1045
+ className: "flex overflow-x-auto gap-2 no-scrollbar items-center",
1068
1046
  ref: listRef
1069
1047
  }, isAll ? /*#__PURE__*/React__default.createElement("div", {
1070
1048
  className: " " + ((Object === null || Object === void 0 ? void 0 : (_Object$keys = Object.keys(value)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) <= 0 ? "bg-primary text-textButton" : "bg-background") + " w-max border border-primary p-1 md:p-2 rounded-lg cursor-pointer whitespace-nowrap",
@@ -9575,7 +9553,7 @@ var TreatmentItem1 = function TreatmentItem1(props) {
9575
9553
  }))));
9576
9554
  };
9577
9555
 
9578
- var ProductsList7 = function ProductsList7(props) {
9556
+ var ProductList7 = function ProductList7(props) {
9579
9557
  var _props$shopConfigStyl = props.shopConfigStyle,
9580
9558
  shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
9581
9559
  _props$data = props.data,
@@ -9660,7 +9638,7 @@ var Carousel = function Carousel(props) {
9660
9638
  className: "relative " + className + " ",
9661
9639
  style: style
9662
9640
  }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
9663
- className: " w-full pe-2 h-full flex gap-2 md:gap-4 xl:gap-6 overflow-x-auto hide-scrollbar",
9641
+ className: " w-full pe-2 h-full flex gap-2 md:gap-4 xl:gap-6 overflow-x-auto no-scrollbar",
9664
9642
  ref: carouselRef
9665
9643
  }, data && (data === null || data === void 0 ? void 0 : data.length) > 0 ? data === null || data === void 0 ? void 0 : data.map(function (item, index) {
9666
9644
  return renderItem(item, index);
@@ -12518,7 +12496,25 @@ var SearchProduct1 = function SearchProduct1(props) {
12518
12496
  setListProducts = _useState[1];
12519
12497
  var _ProductController = ProductController(_extends({}, props)),
12520
12498
  getProductListSearch = _ProductController.getProductListSearch;
12499
+ var _useState2 = React.useState(""),
12500
+ valueSearch = _useState2[0],
12501
+ setSearchValue = _useState2[1];
12502
+ React.useEffect(function () {
12503
+ if (valueSearch === "") {
12504
+ setProducts([]);
12505
+ } else {
12506
+ var delayDebounceFn = setTimeout(function () {
12507
+ handleSearch(valueSearch);
12508
+ }, 500);
12509
+ return function () {
12510
+ return clearTimeout(delayDebounceFn);
12511
+ };
12512
+ }
12513
+ }, [valueSearch]);
12521
12514
  var handleSearch = function handleSearch(productName) {
12515
+ if (productName === void 0) {
12516
+ productName = "";
12517
+ }
12522
12518
  try {
12523
12519
  var _temp = function () {
12524
12520
  if (productName) {
@@ -12545,7 +12541,7 @@ var SearchProduct1 = function SearchProduct1(props) {
12545
12541
  },
12546
12542
  inputClassName: "w-full h-full p-2 text-lg",
12547
12543
  placeholder: (data === null || data === void 0 ? void 0 : data.sectionTitle) || "Tìm kiếm sản phẩm",
12548
- onChange: handleSearch,
12544
+ onChange: setSearchValue,
12549
12545
  icons: /*#__PURE__*/React__default.createElement("div", {
12550
12546
  className: "px-2"
12551
12547
  }, /*#__PURE__*/React__default.createElement(fi.FiSearch, {
@@ -12583,15 +12579,32 @@ var SearchBar2 = function SearchBar2(props) {
12583
12579
  var _useState = React.useState([]),
12584
12580
  products = _useState[0],
12585
12581
  setProducts = _useState[1];
12582
+ var _useState2 = React.useState(""),
12583
+ valueSearch = _useState2[0],
12584
+ setSearchValue = _useState2[1];
12586
12585
  var _ProductController = ProductController(_extends({}, props)),
12587
12586
  getProductListSearch = _ProductController.getProductListSearch;
12587
+ React.useEffect(function () {
12588
+ if (valueSearch === "") {
12589
+ setProducts([]);
12590
+ } else {
12591
+ var delayDebounceFn = setTimeout(function () {
12592
+ handleSearch(valueSearch);
12593
+ }, 500);
12594
+ return function () {
12595
+ return clearTimeout(delayDebounceFn);
12596
+ };
12597
+ }
12598
+ }, [valueSearch]);
12588
12599
  var handleSearch = function handleSearch(productName) {
12589
12600
  if (productName === void 0) {
12590
12601
  productName = "";
12591
12602
  }
12592
12603
  try {
12593
12604
  var _temp = function () {
12594
- if (productName === "") setProducts([]);else {
12605
+ if (productName === "") {
12606
+ setProducts([]);
12607
+ } else {
12595
12608
  return Promise.resolve(getProductListSearch({
12596
12609
  productName: productName
12597
12610
  })).then(function (productList) {
@@ -12613,7 +12626,7 @@ var SearchBar2 = function SearchBar2(props) {
12613
12626
  className: "w-full",
12614
12627
  inputClassName: "w-full",
12615
12628
  placeholder: data !== null && data !== void 0 && data.sectionTitle ? data === null || data === void 0 ? void 0 : data.sectionTitle : "Tìm kiếm sản phẩm",
12616
- onChange: handleSearch
12629
+ onChange: setSearchValue
12617
12630
  }), (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
12618
12631
  className: "max-h-64 overflow-y-auto flex flex-col gap-2"
12619
12632
  }, products === null || products === void 0 ? void 0 : products.map(function (item, index) {
@@ -12937,12 +12950,12 @@ exports.ProductItem5 = ProductItem5;
12937
12950
  exports.ProductItem6 = ProductItem6;
12938
12951
  exports.ProductItem7 = ProductItem7;
12939
12952
  exports.ProductList5 = ProductList5;
12953
+ exports.ProductList7 = ProductList7;
12940
12954
  exports.ProductSale2 = ProductSale2;
12941
12955
  exports.ProductSearch1 = ProductSearch1;
12942
12956
  exports.Products10 = Products10;
12943
12957
  exports.Products2 = Products2;
12944
12958
  exports.Products3 = Products3;
12945
- exports.ProductsList7 = ProductsList7;
12946
12959
  exports.ProductsTop1 = ProductsTop1;
12947
12960
  exports.SearchBar2 = SearchBar2;
12948
12961
  exports.SearchBar5 = SearchBar5;