@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.
@@ -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;AAM9D,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAiBtD;AAED,OAAO,EAAE,aAAa,EAAE,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
- toast((t) => _jsx(Toast, { ...props }), {
8
- style: {
9
- padding: 0,
10
- background: "transparent",
11
- boxShadow: "none",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "1.3.135",
3
+ "version": "1.3.139",
4
4
  "main": "./dist/bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Lucas Gonçalves",
@@ -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
- toast((t) => <Toast {...props} />, {
10
- style: {
11
- padding: 0,
12
- background: "transparent",
13
- boxShadow: "none",
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 (