diy-template-components 2.0.98 → 2.0.100

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.es.js CHANGED
@@ -1398,6 +1398,7 @@ function DesktopHeader({
1398
1398
  onDownloadAppTriggered,
1399
1399
  extraProps
1400
1400
  }) {
1401
+ const [isVisible, setIsVisible] = useState(false);
1401
1402
  const {
1402
1403
  isFixed = true
1403
1404
  } = header;
@@ -1422,6 +1423,24 @@ function DesktopHeader({
1422
1423
  }
1423
1424
  return optionsData;
1424
1425
  };
1426
+ useEffect(() => {
1427
+ if (!header?.effectivePrice) {
1428
+ return;
1429
+ }
1430
+ const handleScroll = () => {
1431
+ if (window.scrollY > 220) {
1432
+ setIsVisible(true);
1433
+ } else {
1434
+ setIsVisible(false);
1435
+ }
1436
+ };
1437
+ window.addEventListener('scroll', handleScroll);
1438
+ return () => {
1439
+ if (header?.effectivePrice) {
1440
+ window.removeEventListener('scroll', handleScroll);
1441
+ }
1442
+ };
1443
+ }, []);
1425
1444
  const moreContentFn = () => {
1426
1445
  let optionsArr = navData;
1427
1446
  let moreContent = [];
@@ -1475,7 +1494,7 @@ function DesktopHeader({
1475
1494
  };
1476
1495
  const OfferDetailsJSX = () => {
1477
1496
  console.log('header', header);
1478
- if (!header?.effectivePrice) {
1497
+ if (!header?.effectivePrice || !isVisible) {
1479
1498
  return null;
1480
1499
  }
1481
1500
  let conversions = extraProps?.conversions || 0;
@@ -1603,6 +1622,7 @@ function MobileHeader({
1603
1622
  isCustomWebsite
1604
1623
  });
1605
1624
  const [sideMenu, openSideMenu] = useState(false);
1625
+ const [isVisible, setIsVisible] = useState(false);
1606
1626
  const navEl = useRef(null);
1607
1627
  useLayoutEffect(() => {
1608
1628
  const body = navEl?.current?.ownerDocument?.body;
@@ -1627,7 +1647,20 @@ function MobileHeader({
1627
1647
  if (body) {
1628
1648
  body.style.marginBottom = '130px';
1629
1649
  }
1650
+ const handleScroll = () => {
1651
+ if (window.scrollY > 220) {
1652
+ setIsVisible(true);
1653
+ } else {
1654
+ setIsVisible(false);
1655
+ }
1656
+ };
1657
+ window.addEventListener('scroll', handleScroll);
1630
1658
  }
1659
+ return () => {
1660
+ if (header?.effectivePrice) {
1661
+ window.removeEventListener('scroll', handleScroll);
1662
+ }
1663
+ };
1631
1664
  }, []);
1632
1665
  let downloadLink = null;
1633
1666
  const downloadAppText = countryCode === 'KR' ? '앱다운로드' : 'Download App';
@@ -1702,7 +1735,7 @@ function MobileHeader({
1702
1735
  return null;
1703
1736
  };
1704
1737
  const BottomSheetJSX = () => {
1705
- if (!header?.effectivePrice) {
1738
+ if (!header?.effectivePrice || !isVisible) {
1706
1739
  return null;
1707
1740
  }
1708
1741
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {