add toastify component
This commit is contained in:
@@ -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 }
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user