Files
frontend/apps/wr/components/ui/toast/toastFromUi.tsx
T
2025-05-02 14:58:18 +09:00

47 lines
1.3 KiB
TypeScript

import { Button } from "@common/components/ui";
import Link from "next/link";
import toast from "react-hot-toast";
interface toastFormType {
body: string;
title: string;
url?: string;
buttonName?: string;
}
export function ToastFormUi({ body, title, url, buttonName }: toastFormType) {
//const router = useRouter();
return toast.custom((t) => (
<div
className={`${
t.visible ? "animate-enter" : "animate-leave"
} w-4/12 h-40 bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5`}
>
<div className="w-full flex-1 py-10">
<div className="flex items-start">
<div className="flex-shrink-0 pt-0.5"></div>
<div className="ml-3 flex-1">
<p className="text-xl font-medium underline">{title}</p>
<p className="mt-1 text-2xl">{body}</p>
</div>
</div>
</div>
<div className="flex py-20">
{url && buttonName ? (
<Button size="sm" onClick={() => toast.dismiss(t.id)}>
<Link href={url}> {buttonName}</Link>
</Button>
) : (
<></>
)}
</div>
<div className="flex pl-4 pr-4 py-20">
<Button onClick={() => toast.dismiss(t.id)} size="sm">
닫기
</Button>
</div>
</div>
));
}