@arkyn/components 1.3.89 → 1.3.90

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAoBA,iBAAS,aAAa,SAuBrB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAqBA,iBAAS,aAAa,SA8BrB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { useActionData } from "@remix-run/react";
2
2
  import { useContext, useEffect } from "react";
3
+ import { animateScroll } from "react-scroll";
3
4
  import { ModalContext } from "../context/ModalContext";
4
5
  import { useToast } from "./useToast";
5
6
  function isToastProps(obj) {
@@ -34,5 +35,11 @@ function useAutomation() {
34
35
  });
35
36
  }
36
37
  }, [actionData]);
38
+ useEffect(() => {
39
+ if (typeof actionData?.data?.scrollTo === "string") {
40
+ const element = document.getElementById(actionData?.data?.scrollTo);
41
+ element && animateScroll.scrollTo(element.offsetTop - 200);
42
+ }
43
+ }, [actionData]);
37
44
  }
38
45
  export { useAutomation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "1.3.89",
3
+ "version": "1.3.90",
4
4
  "main": "./dist/bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Lucas Gonçalves",
@@ -15,6 +15,7 @@
15
15
  "@react-input/mask": "^1.2.5",
16
16
  "framer-motion": "^11.3.21",
17
17
  "lucide-react": "^0.424.0",
18
+ "react-scroll": "^1.9.0",
18
19
  "sonner": "^1.5.0"
19
20
  },
20
21
  "peerDependencies": {
@@ -1,6 +1,7 @@
1
+ import { ToastProps } from "@arkyn/types";
1
2
  import { useActionData } from "@remix-run/react";
2
3
  import { useContext, useEffect } from "react";
3
- import { ToastProps } from "@arkyn/types";
4
+ import { animateScroll } from "react-scroll";
4
5
 
5
6
  import { ModalContext } from "../context/ModalContext";
6
7
  import { useToast } from "./useToast";
@@ -41,6 +42,13 @@ function useAutomation() {
41
42
  });
42
43
  }
43
44
  }, [actionData]);
45
+
46
+ useEffect(() => {
47
+ if (typeof actionData?.data?.scrollTo === "string") {
48
+ const element = document.getElementById(actionData?.data?.scrollTo);
49
+ element && animateScroll.scrollTo(element.offsetTop - 200);
50
+ }
51
+ }, [actionData]);
44
52
  }
45
53
 
46
54
  export { useAutomation };