ce98978ebd
Docker Release / Check web and api (push) Waiting to run
Docker Release / Resolve release tag (push) Blocked by required conditions
Docker Release / Build and publish all-in-one (push) Blocked by required conditions
Docker Release / Build and publish api (push) Blocked by required conditions
Docker Release / Build and publish web (push) Blocked by required conditions
Docker Release / Build and publish dovecot (push) Blocked by required conditions
Docker Release / Build and publish postfix (push) Blocked by required conditions
Docker Release / Build and publish rspamd (push) Blocked by required conditions
Docker Release / Create GitHub release (push) Blocked by required conditions
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { Button } from "@/components/ui/button"
|
|
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
|
|
|
|
type ConfirmDialogProps = {
|
|
open: boolean
|
|
title: string
|
|
description?: string
|
|
confirmText?: string
|
|
cancelText?: string
|
|
destructive?: boolean
|
|
pending?: boolean
|
|
onOpenChange: (open: boolean) => void
|
|
onConfirm: () => void
|
|
}
|
|
|
|
export function ConfirmDialog({
|
|
open,
|
|
title,
|
|
description,
|
|
confirmText = "确认",
|
|
cancelText = "取消",
|
|
destructive = false,
|
|
pending = false,
|
|
onOpenChange,
|
|
onConfirm,
|
|
}: ConfirmDialogProps) {
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent className="w-[calc(100vw-2rem)] max-w-lg rounded-lg">
|
|
<DialogHeader>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
</DialogHeader>
|
|
{description && <div className="text-sm text-muted-foreground">{description}</div>}
|
|
<DialogFooter className="gap-2 [&>button]:min-h-11 sm:[&>button]:min-h-9">
|
|
<Button type="button" variant="outline" onClick={() => onOpenChange(false)} disabled={pending}>
|
|
{cancelText}
|
|
</Button>
|
|
<Button type="button" variant={destructive ? "destructive" : "default"} onClick={onConfirm} disabled={pending}>
|
|
{pending ? "处理中..." : confirmText}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|