diy-template-components 2.0.97 → 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.es.js +40 -12
- package/build/index.es.js.map +1 -1
- package/build/index.js +40 -12
- package/build/index.js.map +1 -1
- package/package.json +1 -1
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,40 +1638,45 @@ 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;
|
|
1625
1645
|
if (body) {
|
|
1626
|
-
console.log("here in nav");
|
|
1627
1646
|
if (sideMenu) {
|
|
1628
1647
|
// body?.setAttribute('style', 'overflow: hidden;');
|
|
1629
|
-
console.log("here in nav before", body, header);
|
|
1630
1648
|
body.style.overflow = 'hidden';
|
|
1631
|
-
console.log("here in nav hidden after", body, header);
|
|
1632
1649
|
} else {
|
|
1633
1650
|
// body?.removeAttribute('style');
|
|
1634
1651
|
body.style.overflow = '';
|
|
1635
|
-
console.log("here in nav hidden else", body, header);
|
|
1636
1652
|
}
|
|
1637
1653
|
if (header?.effectivePrice) {
|
|
1638
|
-
console.log("here in effectivePrice if before", body, header);
|
|
1639
1654
|
body.style.marginBottom = '130px';
|
|
1640
|
-
console.log("here in effectivePrice if after", body, header);
|
|
1641
1655
|
} else {
|
|
1642
|
-
console.log("here in effectivePrice else before", body, header);
|
|
1643
1656
|
body.style.marginBottom = '';
|
|
1644
|
-
console.log("here in effectivePrice else before", body, header);
|
|
1645
1657
|
}
|
|
1646
1658
|
}
|
|
1647
1659
|
}, [sideMenu, header?.effectivePrice]);
|
|
1648
1660
|
React.useEffect(() => {
|
|
1649
1661
|
if (header?.effectivePrice) {
|
|
1650
|
-
console.log("here in use effect");
|
|
1651
1662
|
const body = navEl?.current?.ownerDocument?.body;
|
|
1652
1663
|
if (body) {
|
|
1653
1664
|
body.style.marginBottom = '130px';
|
|
1654
1665
|
}
|
|
1666
|
+
const handleScroll = () => {
|
|
1667
|
+
if (window.scrollY > 200) {
|
|
1668
|
+
setIsVisible(true);
|
|
1669
|
+
} else {
|
|
1670
|
+
setIsVisible(false);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
window.addEventListener('scroll', handleScroll);
|
|
1655
1674
|
}
|
|
1675
|
+
return () => {
|
|
1676
|
+
if (header?.effectivePrice) {
|
|
1677
|
+
window.removeEventListener('scroll', handleScroll);
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1656
1680
|
}, []);
|
|
1657
1681
|
let downloadLink = null;
|
|
1658
1682
|
const downloadAppText = countryCode === 'KR' ? '앱다운로드' : 'Download App';
|
|
@@ -1709,7 +1733,11 @@ function MobileHeader({
|
|
|
1709
1733
|
}
|
|
1710
1734
|
};
|
|
1711
1735
|
const OfferDetailsJSX = () => {
|
|
1712
|
-
console.log('
|
|
1736
|
+
console.log('offer details jsx', header);
|
|
1737
|
+
const body = navEl?.current?.ownerDocument?.body;
|
|
1738
|
+
if (body) {
|
|
1739
|
+
body.style.marginBottom = '130px';
|
|
1740
|
+
}
|
|
1713
1741
|
let conversions = extraProps?.conversions || 0;
|
|
1714
1742
|
const currentTimestamp = new Date().getTime();
|
|
1715
1743
|
if (header?.isOfferActive && header?.endDate && header?.endDate && header?.endDate > currentTimestamp && (header?.offerPriceValidFor ? header.offerPriceValidFor - conversions > 0 : true)) {
|
|
@@ -1723,7 +1751,7 @@ function MobileHeader({
|
|
|
1723
1751
|
return null;
|
|
1724
1752
|
};
|
|
1725
1753
|
const BottomSheetJSX = () => {
|
|
1726
|
-
if (!header?.effectivePrice) {
|
|
1754
|
+
if (!header?.effectivePrice || !isVisible) {
|
|
1727
1755
|
return null;
|
|
1728
1756
|
}
|
|
1729
1757
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|