gatsby-core-theme 18.0.7 → 18.0.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [18.0.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.8...v18.0.9) (2023-02-06)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * remove --scroll-to-top-bottom-offset css var ([7231d0d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7231d0da6ff48e0c0df956470b68ec8c129a1573))
7
+ * update sticky scroll hook ([d813ef8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d813ef894b1c7f517d7e81b2062ffe360567f61b))
8
+
9
+
10
+ * Merge branch 'tm-3097-update-general-scroll-hook' into 'master' ([150188a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/150188a0b0802363bdb773efe7454b79992b365c))
11
+
12
+ ## [18.0.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.7...v18.0.8) (2023-02-06)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add validation for bonus ([476287e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/476287eb552f51e3ce1aa6d433479017ad71e79e))
18
+
19
+
20
+ * Merge branch 'validation-bonus' into 'master' ([cf8b25b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cf8b25b5efa4f5f81eb123543116f42b1ea7fe77))
21
+
1
22
  ## [18.0.7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.6...v18.0.7) (2023-02-02)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "18.0.7",
3
+ "version": "18.0.9",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -21,14 +21,14 @@ export default function OperatorBanner({
21
21
  pageTemplate,
22
22
  }) {
23
23
  const prettyLink = prettyTracker(operator, 'main', false, pageTemplate);
24
- const [show, setShow] = useState(false);
24
+ const [show, setShow] = useState(!sticky);
25
25
  const [closed, setClosed] = useState(false);
26
26
  const { cookieAccepted, setBannerActive } = useContext(Context) || {};
27
27
 
28
28
  const status = operator?.status;
29
29
  const isPlaceholder = status === 'coming_soon';
30
30
 
31
- isSticky(stickyOffset, setShow);
31
+ sticky && isSticky(stickyOffset, setShow);
32
32
  useEffect(() => {
33
33
  // eslint-disable-next-line no-unused-expressions
34
34
  sticky && setBannerActive(show);
@@ -37,7 +37,6 @@ export default function OperatorBanner({
37
37
  const clickHandler = () => {
38
38
  setShow(false);
39
39
  setClosed(true);
40
- setBannerActive(false);
41
40
  };
42
41
 
43
42
  return (
@@ -1,6 +1,5 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import useIsMobile from '~hooks/useIsMobile';
4
3
  import isSticky from '~hooks/stickyOnScroll';
5
4
  import styles from './sticky.module.scss';
6
5
 
@@ -11,24 +10,8 @@ const Sticky = ({
11
10
  className = '',
12
11
  children,
13
12
  }) => {
14
- const isMobile = useIsMobile();
15
13
  const sticky = isSticky();
16
14
 
17
- useEffect(() => {
18
- if (position === 'bottom') {
19
- document?.documentElement.style.setProperty(
20
- '--scroll-to-top-bottom-offset',
21
- isMobile ? '18rem' : '11rem'
22
- );
23
- }
24
-
25
- return () => {
26
- if (position === 'bottom' && document.getElementsByClassName(styles.sticky).length === 2) {
27
- document?.documentElement.style.removeProperty('--scroll-to-top-bottom-offset');
28
- }
29
- };
30
- });
31
-
32
15
  return (
33
16
  <div
34
17
  className={`${styles.sticky} ${position === 'top' && styles.top} ${
@@ -17,6 +17,7 @@ function Anchor({
17
17
  module: { items },
18
18
  headerOffset = 60,
19
19
  isFixed = true,
20
+ stickyOffset = 0,
20
21
  icon = null,
21
22
  showTitle = true,
22
23
  heightOfAnchor = 60,
@@ -108,7 +109,7 @@ function Anchor({
108
109
  }
109
110
  };
110
111
 
111
- const sticky = isFixed && isSticky(anchorContainerRef?.current?.offsetTop, setActiveAnchor);
112
+ const sticky = isFixed && isSticky(stickyOffset, setActiveAnchor, anchorContainerRef);
112
113
  return (
113
114
  <div className={styles.containerAnchor} ref={anchorContainerRef}>
114
115
  {showTitle ? (
@@ -69,7 +69,7 @@ export function clonePageForCards(item, style) {
69
69
 
70
70
  const object = pick(item, pickPageKeys);
71
71
  object.relation = pick(item.relation, pickRelationKeys[item.type]);
72
- if (item.type === 'operator' && style !== 'comparison_table') {
72
+ if (item.type === 'operator' && style !== 'comparison_table' && object.relation.bonus) {
73
73
  delete object.relation.bonus.deposit_methods;
74
74
  }
75
75
 
@@ -3,23 +3,25 @@
3
3
  import { useEffect, useState } from 'react';
4
4
  import { debounce } from '~helpers/scroll';
5
5
 
6
- export default function StickyOnScroll(offset = 0, callback) {
6
+ export default function StickyOnScroll(stickyOffset = 0, callback, elementRef) {
7
7
  const [sticky, setSticky] = useState(false);
8
8
 
9
9
  const handler = debounce(() => {
10
- if (typeof window !== 'undefined' && typeof offset === 'number') {
10
+ if (typeof window !== 'undefined' && typeof stickyOffset === 'number') {
11
+ const offset =
12
+ elementRef?.current?.getBoundingClientRect()?.top + window.pageYOffset || 0 + stickyOffset;
11
13
  const isSticky = window.pageYOffset > offset;
12
14
  sticky !== isSticky && setSticky(isSticky);
13
15
  callback && callback(isSticky);
14
16
  }
15
- });
17
+ }, 200);
16
18
 
17
19
  useEffect(() => {
18
20
  window.addEventListener('scroll', handler);
19
21
  return () => {
20
22
  window.removeEventListener('scroll', handler);
21
23
  };
22
- }, [sticky, offset]);
24
+ }, [sticky, stickyOffset]);
23
25
 
24
26
  return sticky;
25
27
  }
@@ -25,6 +25,7 @@
25
25
  --body-background-color: var(--color-5);
26
26
 
27
27
  // Spacing and sizes - site
28
+ --nav-height: 6rem;
28
29
  --module-spacing: 2rem;
29
30
  --side-container: 30rem;
30
31
  --main-container-max: 96rem;
@@ -43,7 +44,7 @@
43
44
  --h5-mobile-size: 1.6rem;
44
45
  --h6-mobile-size: 1.5rem;
45
46
 
46
- // Line heights - site
47
+ // Line heights - site
47
48
  --h1-line-height: 4.2rem;
48
49
  --h2-line-height: 3.4rem;
49
50
  --h3-line-height: 3.2rem;
@@ -101,8 +102,6 @@
101
102
  --cookie-consent-text-color: var(--color-18);
102
103
  --cookie-consent-text-size: 1.4rem;
103
104
 
104
- --scroll-to-top-bottom-offset: 2rem;
105
-
106
105
  --toplist-ranking-first-color: var(--color-14);
107
106
  --toplist-ranking-second-color: var(--color-8);
108
107
  --toplist-ranking-third-color: var(--color-15);