import { ExclamationIcon } from "@heroicons/react/outline"; import { CheckIcon } from "@heroicons/react/solid"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import React, { PropsWithChildren, ReactNode } from "react"; import { useLocale } from "@lib/hooks/useLocale"; import { DialogClose, DialogContent } from "@components/Dialog"; import { Button } from "@components/ui/Button"; export type ConfirmationDialogContentProps = { confirmBtn?: ReactNode; confirmBtnText?: string; cancelBtnText?: string; onConfirm?: (event: React.MouseEvent) => void; title: string; variety?: "danger" | "warning" | "success"; }; export default function ConfirmationDialogContent(props: PropsWithChildren) { const { t } = useLocale(); const { title, variety, confirmBtn = null, confirmBtnText = t("confirm"), cancelBtnText = t("cancel"), onConfirm, children, } = props; return (
{variety && (
{variety === "danger" && (
)} {variety === "warning" && (
)} {variety === "success" && (
)}
)}
{title} {children}
{confirmBtn || }
); }