@arkyn/components 1.3.135 → 1.3.139
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +1130 -1131
- package/dist/bundle.umd.cjs +30 -30
- package/dist/provider/ToastProvider.d.ts.map +1 -1
- package/dist/provider/ToastProvider.js +6 -8
- package/package.json +1 -1
- package/src/provider/ToastProvider.tsx +6 -8
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAK9D,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAgBtD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -1,16 +1,14 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import toast, { Toaster } from "react-hot-toast";
|
3
3
|
import { ToastContext } from "../context/ToastContext";
|
4
|
-
import { Toast } from "../components/Toast";
|
5
4
|
function ToastProvider({ children }) {
|
6
5
|
function showToast(props) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
});
|
6
|
+
switch (props.type) {
|
7
|
+
case "success":
|
8
|
+
return toast.success(props.message);
|
9
|
+
case "danger":
|
10
|
+
return toast.error(props.message);
|
11
|
+
}
|
14
12
|
}
|
15
13
|
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [_jsx(Toaster, { position: "top-right" }), children] }));
|
16
14
|
}
|
package/package.json
CHANGED
@@ -2,17 +2,15 @@ import { ToastProps, ToastProviderProps } from "@arkyn/types";
|
|
2
2
|
import toast, { Toaster } from "react-hot-toast";
|
3
3
|
|
4
4
|
import { ToastContext } from "../context/ToastContext";
|
5
|
-
import { Toast } from "../components/Toast";
|
6
5
|
|
7
6
|
function ToastProvider({ children }: ToastProviderProps) {
|
8
7
|
function showToast(props: ToastProps) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
});
|
8
|
+
switch (props.type) {
|
9
|
+
case "success":
|
10
|
+
return toast.success(props.message);
|
11
|
+
case "danger":
|
12
|
+
return toast.error(props.message);
|
13
|
+
}
|
16
14
|
}
|
17
15
|
|
18
16
|
return (
|