diy-template-components 2.0.98 → 2.0.99

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/build/index.js CHANGED
@@ -1414,6 +1414,7 @@ function DesktopHeader({
1414
1414
  onDownloadAppTriggered,
1415
1415
  extraProps
1416
1416
  }) {
1417
+ const [isVisible, setIsVisible] = React.useState(false);
1417
1418
  const {
1418
1419
  isFixed = true
1419
1420
  } = header;
@@ -1438,6 +1439,24 @@ function DesktopHeader({
1438
1439
  }
1439
1440
  return optionsData;
1440
1441
  };
1442
+ React.useEffect(() => {
1443
+ if (!header?.effectivePrice) {
1444
+ return;
1445
+ }
1446
+ const handleScroll = () => {
1447
+ if (window.scrollY > 200) {
1448
+ setIsVisible(true);
1449
+ } else {
1450
+ setIsVisible(false);
1451
+ }
1452
+ };
1453
+ window.addEventListener('scroll', handleScroll);
1454
+ return () => {
1455
+ if (header?.effectivePrice) {
1456
+ window.removeEventListener('scroll', handleScroll);
1457
+ }
1458
+ };
1459
+ }, []);
1441
1460
  const moreContentFn = () => {
1442
1461
  let optionsArr = navData;
1443
1462
  let moreContent = [];
@@ -1491,7 +1510,7 @@ function DesktopHeader({
1491
1510
  };
1492
1511
  const OfferDetailsJSX = () => {
1493
1512
  console.log('header', header);
1494
- if (!header?.effectivePrice) {
1513
+ if (!header?.effectivePrice || !isVisible) {
1495
1514
  return null;
1496
1515
  }
1497
1516
  let conversions = extraProps?.conversions || 0;
@@ -1619,6 +1638,7 @@ function MobileHeader({
1619
1638
  isCustomWebsite
1620
1639
  });
1621
1640
  const [sideMenu, openSideMenu] = React.useState(false);
1641
+ const [isVisible, setIsVisible] = React.useState(false);
1622
1642
  const navEl = React.useRef(null);
1623
1643
  React.useLayoutEffect(() => {
1624
1644
  const body = navEl?.current?.ownerDocument?.body;
@@ -1643,7 +1663,20 @@ function MobileHeader({
1643
1663
  if (body) {
1644
1664
  body.style.marginBottom = '130px';
1645
1665
  }
1666
+ const handleScroll = () => {
1667
+ if (window.scrollY > 200) {
1668
+ setIsVisible(true);
1669
+ } else {
1670
+ setIsVisible(false);
1671
+ }
1672
+ };
1673
+ window.addEventListener('scroll', handleScroll);
1646
1674
  }
1675
+ return () => {
1676
+ if (header?.effectivePrice) {
1677
+ window.removeEventListener('scroll', handleScroll);
1678
+ }
1679
+ };
1647
1680
  }, []);
1648
1681
  let downloadLink = null;
1649
1682
  const downloadAppText = countryCode === 'KR' ? '앱다운로드' : 'Download App';
@@ -1718,7 +1751,7 @@ function MobileHeader({
1718
1751
  return null;
1719
1752
  };
1720
1753
  const BottomSheetJSX = () => {
1721
- if (!header?.effectivePrice) {
1754
+ if (!header?.effectivePrice || !isVisible) {
1722
1755
  return null;
1723
1756
  }
1724
1757
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {