49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
|
|
// Новые импорты из shadcn/ui
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
} from "@/components/ui/alert-dialog";
|
|
import { buttonVariants } from "@/components/ui/button";
|
|
import { cn } from "@root/lib/utils";
|
|
|
|
interface Props {
|
|
open: boolean;
|
|
title: string;
|
|
description: string;
|
|
onOpenChange: (open: boolean) => void; // shadcn использует этот коллбэк
|
|
onConfirm: () => void;
|
|
}
|
|
|
|
export const ConfirmViewer = (props: Props) => {
|
|
const { open, title, description, onOpenChange, onConfirm } = props;
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>{title}</AlertDialogTitle>
|
|
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>{t("Cancel")}</AlertDialogCancel>
|
|
<AlertDialogAction
|
|
className={cn(buttonVariants({ variant: "destructive" }))}
|
|
onClick={onConfirm}
|
|
>
|
|
{t("Confirm")}
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
);
|
|
};
|