add toastify component

This commit is contained in:
Ehsan
2024-10-26 00:51:59 +03:30
parent 638d0d78f5
commit 60276b3ba0
9 changed files with 121 additions and 5 deletions
+20
View File
@@ -1,4 +1,5 @@
import moment from "jalali-moment";
import { toast } from "react-toastify";
export const numberToArStyle = (num) => num.toLocaleString("ar-AE");
@@ -78,3 +79,22 @@ export const uploadImage = async (event) => {
throw new Error("No file selected");
}
};
export const alert = (type, text, prop) => {
toast[type](
<div className="h-full w-full flex flex-col items-start justify-center gap-[13px]">
<p className="text-[14px] font-medium">
پیغام{" "}
{type === "error"
? "خطا"
: type === "warning"
? "هشدار"
: type === "info"
? "اعلام"
: "موفقیت"}
</p>
<p className="text-[14px] font-normal">{text}</p>
</div>,
{ prop }
);
};