@netlify/spark-ui 0.0.25 → 0.0.26
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.
|
@@ -67,18 +67,17 @@ function K(t) {
|
|
|
67
67
|
function J(t = { className: "", children: null }) {
|
|
68
68
|
const [s, o] = N(!1);
|
|
69
69
|
v(() => {
|
|
70
|
+
let f;
|
|
70
71
|
const y = () => {
|
|
71
|
-
window.pagefind && (o(!0),
|
|
72
|
+
window.pagefind && (o(!0), f && clearInterval(f));
|
|
72
73
|
};
|
|
73
|
-
y();
|
|
74
|
-
const d = setInterval(y, 100);
|
|
75
|
-
return () => clearInterval(d);
|
|
74
|
+
return y(), f = setInterval(y, 100), () => clearInterval(f);
|
|
76
75
|
}, []);
|
|
77
|
-
const { children: c, className: l, ...e } = t, { state: r, actions: a } = L(), [u, S] = N(!1),
|
|
78
|
-
return k(s,
|
|
76
|
+
const { children: c, className: l, ...e } = t, { state: r, actions: a } = L(), [u, S] = N(!1), m = () => S(!0), d = () => S(!1), i = O(null), g = K(d);
|
|
77
|
+
return k(s, m), j(s, a.setSearchTerm, m), E(s, u, m, d), P(s, i, u, d), v(() => {
|
|
79
78
|
i.current && (u ? i.current.showModal() : i.current.close());
|
|
80
79
|
}, [u]), /* @__PURE__ */ n(T, { ref: i, className: A(l, "n-search-modal"), ...e, children: /* @__PURE__ */ n("div", { ref: g, className: "n-search-container", children: [
|
|
81
|
-
/* @__PURE__ */ n(
|
|
80
|
+
/* @__PURE__ */ n(I, { setSearchTerm: a.setSearchTerm, initialValue: r.searchTerm }),
|
|
82
81
|
/* @__PURE__ */ n(
|
|
83
82
|
b,
|
|
84
83
|
{
|
package/package.json
CHANGED
|
@@ -27,6 +27,8 @@ function SearchModal(props: Props = {className: '', children: null}) {
|
|
|
27
27
|
|
|
28
28
|
// Poll for the existence of window.pagefind.
|
|
29
29
|
useEffect(() => {
|
|
30
|
+
let intervalId:number;
|
|
31
|
+
|
|
30
32
|
const checkForPagefind = () => {
|
|
31
33
|
if (window.pagefind) {
|
|
32
34
|
setIsPagefindLoaded(true);
|
|
@@ -36,7 +38,7 @@ function SearchModal(props: Props = {className: '', children: null}) {
|
|
|
36
38
|
|
|
37
39
|
// Check immediately and then start polling every 100ms.
|
|
38
40
|
checkForPagefind();
|
|
39
|
-
|
|
41
|
+
intervalId = setInterval(checkForPagefind, 100);
|
|
40
42
|
|
|
41
43
|
// Cleanup the interval when the component unmounts.
|
|
42
44
|
return () => clearInterval(intervalId);
|
|
@@ -66,9 +68,7 @@ function SearchModal(props: Props = {className: '', children: null}) {
|
|
|
66
68
|
return (
|
|
67
69
|
<Modal ref={modalRef} className={cn(className, 'n-search-modal')} {...rest}>
|
|
68
70
|
<div ref={containerRef} className="n-search-container">
|
|
69
|
-
<form className="n-search-bar">
|
|
70
71
|
<SearchInput setSearchTerm={actions.setSearchTerm} initialValue={state.searchTerm} />
|
|
71
|
-
</form>
|
|
72
72
|
|
|
73
73
|
<SearchWindow
|
|
74
74
|
searchLoading={state.isLoading}
|