gatsby-core-theme 30.0.20 → 30.0.22
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,17 @@
|
|
|
1
|
+
## [30.0.22](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.21...v30.0.22) (2023-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add scroll event ([eee64c4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eee64c4f48461b246a1420749fa2bb93d7c3f0f5))
|
|
7
|
+
|
|
8
|
+
## [30.0.21](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.20...v30.0.21) (2023-11-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change import because we have problem on storybook on matrix ([7daaefd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7daaefd03056d186bd0607d56bf15164e48ae02b))
|
|
14
|
+
|
|
1
15
|
## [30.0.20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.19...v30.0.20) (2023-11-19)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { useContext } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import Button from '~atoms/button/button';
|
|
8
|
-
import imgSize from '
|
|
8
|
+
import imgSize from '../../../constants/spotlight-image-dimensions';
|
|
9
9
|
import LazyImage from '~hooks/lazy-image';
|
|
10
10
|
import keygen from '~helpers/keygen';
|
|
11
11
|
import { imagePrettyUrl, getImageFilename, getAltText, translate } from '~helpers/getters';
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
1
2
|
import React, { useEffect } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const ScrollX = ({
|
|
6
|
+
children,
|
|
7
|
+
refTag = {},
|
|
8
|
+
scroll = false,
|
|
9
|
+
stopScrolling = () => {},
|
|
10
|
+
onScroll = () => {},
|
|
11
|
+
}) => {
|
|
6
12
|
let pos = { top: 0, left: 0, x: 0, y: 0 };
|
|
7
13
|
|
|
8
14
|
const preventDefaultEvents = (e) => {
|
|
@@ -53,14 +59,22 @@ const ScrollX = ({ children, refTag = {}, scroll = false, stopScrolling = () =>
|
|
|
53
59
|
refTag.current.addEventListener('mouseleave', mouseUp);
|
|
54
60
|
};
|
|
55
61
|
|
|
62
|
+
const handleScroll = () => {
|
|
63
|
+
onScroll(refTag.current.scrollLeft);
|
|
64
|
+
};
|
|
65
|
+
|
|
56
66
|
useEffect(() => {
|
|
57
67
|
if (scroll) {
|
|
58
68
|
refTag.current.style.cursor = 'grab';
|
|
59
69
|
refTag.current.addEventListener('mousedown', mouseDown);
|
|
70
|
+
refTag.current.addEventListener('scroll', handleScroll);
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
return () => {
|
|
74
|
+
refTag.current?.removeEventListener('mousedown', mouseDown);
|
|
75
|
+
refTag.current?.removeEventListener('scroll', handleScroll);
|
|
76
|
+
};
|
|
77
|
+
}, [scroll]);
|
|
64
78
|
|
|
65
79
|
return <>{children}</>;
|
|
66
80
|
};
|
|
@@ -69,6 +83,8 @@ ScrollX.propTypes = {
|
|
|
69
83
|
children: PropTypes.node,
|
|
70
84
|
refTag: PropTypes.shape({}),
|
|
71
85
|
scroll: PropTypes.bool,
|
|
86
|
+
onScroll: PropTypes.func,
|
|
87
|
+
stopScrolling: PropTypes.func,
|
|
72
88
|
};
|
|
73
89
|
|
|
74
90
|
export default ScrollX;
|