@gustavo-valsechi/client 1.4.66 → 1.4.68
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.
|
@@ -34,7 +34,7 @@ __export(target_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(target_exports);
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react =
|
|
37
|
+
var import_react = require("react");
|
|
38
38
|
var import_styles = require("./styles");
|
|
39
39
|
var import_lodash = __toESM(require("lodash"));
|
|
40
40
|
const TargetContext = (0, import_react.createContext)({});
|
|
@@ -62,7 +62,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
62
62
|
setShow(showMemory);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
}, [targets]);
|
|
65
|
+
}, [targets, setShow]);
|
|
66
66
|
const getCoords = (target) => {
|
|
67
67
|
const rect = target.getBoundingClientRect();
|
|
68
68
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -88,13 +88,11 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
88
88
|
memory.slice(index, 1);
|
|
89
89
|
setTargets(memory);
|
|
90
90
|
};
|
|
91
|
+
console.log("show fora", show);
|
|
91
92
|
const renderTarget = (0, import_react.useCallback)((target, index) => {
|
|
92
|
-
console.log("show", show);
|
|
93
|
-
console.log("show", showMemory);
|
|
93
|
+
console.log("show dentro", show);
|
|
94
94
|
const targetContent = import_lodash.default.find(show, (data) => data.index === index);
|
|
95
|
-
|
|
96
|
-
if (!targetContent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, {}, index);
|
|
97
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
return !!targetContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
96
|
import_styles.Container,
|
|
99
97
|
{
|
|
100
98
|
style: targetContent.coords,
|
|
@@ -102,7 +100,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
102
100
|
},
|
|
103
101
|
index
|
|
104
102
|
);
|
|
105
|
-
}, [show
|
|
103
|
+
}, [show]);
|
|
106
104
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
107
105
|
TargetContext.Provider,
|
|
108
106
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { createContext, useContext, useEffect, useState, useCallback } from "react";
|
|
4
4
|
import { Container } from "./styles";
|
|
5
5
|
import _ from "lodash";
|
|
6
6
|
const TargetContext = createContext({});
|
|
@@ -28,7 +28,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
28
28
|
setShow(showMemory);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
-
}, [targets]);
|
|
31
|
+
}, [targets, setShow]);
|
|
32
32
|
const getCoords = (target) => {
|
|
33
33
|
const rect = target.getBoundingClientRect();
|
|
34
34
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -54,13 +54,11 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
54
54
|
memory.slice(index, 1);
|
|
55
55
|
setTargets(memory);
|
|
56
56
|
};
|
|
57
|
+
console.log("show fora", show);
|
|
57
58
|
const renderTarget = useCallback((target, index) => {
|
|
58
|
-
console.log("show", show);
|
|
59
|
-
console.log("show", showMemory);
|
|
59
|
+
console.log("show dentro", show);
|
|
60
60
|
const targetContent = _.find(show, (data) => data.index === index);
|
|
61
|
-
|
|
62
|
-
if (!targetContent) return /* @__PURE__ */ jsx(React.Fragment, {}, index);
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
61
|
+
return !!targetContent && /* @__PURE__ */ jsx(
|
|
64
62
|
Container,
|
|
65
63
|
{
|
|
66
64
|
style: targetContent.coords,
|
|
@@ -68,7 +66,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
68
66
|
},
|
|
69
67
|
index
|
|
70
68
|
);
|
|
71
|
-
}, [show
|
|
69
|
+
}, [show]);
|
|
72
70
|
return /* @__PURE__ */ jsxs(
|
|
73
71
|
TargetContext.Provider,
|
|
74
72
|
{
|