Build, Test, and Push CFDM Docker Image / test (push) Failing after 51s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Has been skipped
Build, Test, and Push CFDM Docker Image / update-wiki (push) Has been skipped
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import type { ReactElement } from 'react'
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
AlertDialogTrigger,
|
|
} from '@cfdm/ui/components/alert-dialog'
|
|
|
|
interface ConfirmDialogProps {
|
|
trigger?: ReactElement
|
|
open?: boolean
|
|
onOpenChange?: (open: boolean) => void
|
|
title: string
|
|
description: string
|
|
confirmLabel?: string
|
|
cancelLabel?: string
|
|
onConfirm: () => void
|
|
disabled?: boolean
|
|
}
|
|
|
|
export function ConfirmDialog({
|
|
trigger,
|
|
open,
|
|
onOpenChange,
|
|
title,
|
|
description,
|
|
confirmLabel = 'Удалить',
|
|
cancelLabel = 'Отмена',
|
|
onConfirm,
|
|
disabled,
|
|
}: ConfirmDialogProps) {
|
|
return (
|
|
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
|
{trigger ? (
|
|
<AlertDialogTrigger disabled={disabled} render={trigger} />
|
|
) : null}
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>{title}</AlertDialogTitle>
|
|
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>{cancelLabel}</AlertDialogCancel>
|
|
<AlertDialogAction variant="destructive" onClick={onConfirm}>
|
|
{confirmLabel}
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
)
|
|
}
|