@thecb/components 7.10.1-beta.2 → 7.10.1-beta.3
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/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import Text from "../../atoms/text";
|
|
|
4
4
|
import { Box } from "../../atoms/layouts";
|
|
5
5
|
import { fallbackValues } from "./TermsAndConditionsModal.theme";
|
|
6
6
|
import { themeComponent } from "../../../util/themeUtils";
|
|
7
|
+
import useScrollTo from "../../../util/useScrollTo";
|
|
7
8
|
|
|
8
9
|
const TermsAndConditionsModal = ({
|
|
9
10
|
link,
|
|
@@ -20,7 +21,10 @@ const TermsAndConditionsModal = ({
|
|
|
20
21
|
<Modal
|
|
21
22
|
modalOpen={isOpen}
|
|
22
23
|
hideModal={() => toggleOpen(false)}
|
|
23
|
-
showModal={() =>
|
|
24
|
+
showModal={() => {
|
|
25
|
+
toggleOpen(true);
|
|
26
|
+
useScrollTo("terms-body-text", 0, 0, false);
|
|
27
|
+
}}
|
|
24
28
|
modalHeaderText={title}
|
|
25
29
|
modalBodyText={
|
|
26
30
|
<Box
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Hook that takes an ID selector for an element on the screen
|
|
3
|
+
And optionally values for top position, left position, smooth behavior
|
|
4
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
5
|
+
|
|
6
|
+
(string, number, number, boolean) => undefined;
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const useScrollTo = (id, top = 0, left = 0, smooth = false) => {
|
|
10
|
+
const scrollItem = document.getElementById(id);
|
|
11
|
+
scrollItem?.scrollTo({ top, left, smooth });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default useScrollTo;
|