@cripty2001/utils 0.0.228 → 0.0.229
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.
|
@@ -2,9 +2,9 @@ import type React from "react";
|
|
|
2
2
|
import type { Dispatcher } from "../Dispatcher";
|
|
3
3
|
export type LoaderProps<T> = {
|
|
4
4
|
data: Dispatcher<unknown, T>;
|
|
5
|
-
children:
|
|
5
|
+
children: (props: {
|
|
6
6
|
data: T;
|
|
7
|
-
}
|
|
7
|
+
}) => React.ReactNode;
|
|
8
8
|
loader?: React.ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export default function Loader<T>(props: LoaderProps<T>): import("react/jsx-runtime").JSX.Element;
|
package/dist/react-ui/loader.js
CHANGED
|
@@ -22,7 +22,6 @@ function Loader(props) {
|
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Content, { data: data, children: props.children, loader: props.loader }) }));
|
|
23
23
|
}
|
|
24
24
|
function Content({ data, children, loader }) {
|
|
25
|
-
const ChildComponent = children;
|
|
26
25
|
if (data.loading)
|
|
27
26
|
return loader ?? ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100vh' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
28
27
|
animation: 'spin 1s linear infinite',
|
|
@@ -34,5 +33,5 @@ function Content({ data, children, loader }) {
|
|
|
34
33
|
} }) }));
|
|
35
34
|
if (!data.ok)
|
|
36
35
|
return (0, jsx_runtime_1.jsx)("div", { style: { color: '#ef4444' }, children: data.error.message });
|
|
37
|
-
return (
|
|
36
|
+
return children({ data: data.data });
|
|
38
37
|
}
|
package/package.json
CHANGED