From 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Tue, 25 Mar 2025 15:55:45 +0900
Subject: initial commit

---
 components/ui/action-dialog.tsx | 54 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 components/ui/action-dialog.tsx

(limited to 'components/ui/action-dialog.tsx')

diff --git a/components/ui/action-dialog.tsx b/components/ui/action-dialog.tsx
new file mode 100644
index 00000000..9927bcc5
--- /dev/null
+++ b/components/ui/action-dialog.tsx
@@ -0,0 +1,54 @@
+"use client"
+
+import * as React from "react"
+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogClose } from "@/components/ui/dialog"
+import { Button } from "@/components/ui/button"
+import { Loader } from "lucide-react"
+
+interface ActionConfirmDialogProps {
+  open: boolean
+  onOpenChange: (open: boolean) => void
+  title: string
+  description?: string
+  confirmLabel?: string
+  confirmVariant?: "default" | "destructive" | "outline" | "secondary" | "ghost"
+  onConfirm: () => Promise<void> | void
+  isLoading?: boolean
+}
+
+export function ActionConfirmDialog({
+  open,
+  onOpenChange,
+  title,
+  description,
+  confirmLabel = "Confirm",
+  confirmVariant = "destructive",
+  onConfirm,
+  isLoading,
+}: ActionConfirmDialogProps) {
+  return (
+    <Dialog open={open} onOpenChange={onOpenChange}>
+      <DialogContent>
+        <DialogHeader>
+          <DialogTitle>{title}</DialogTitle>
+          {description ? <DialogDescription>{description}</DialogDescription> : null}
+        </DialogHeader>
+        <DialogFooter className="gap-2">
+          <DialogClose asChild>
+            <Button variant="outline">Cancel</Button>
+          </DialogClose>
+          <Button
+            variant={confirmVariant}
+            onClick={onConfirm}
+            disabled={isLoading}
+          >
+            {isLoading && (
+              <Loader className="mr-2 size-4 animate-spin" aria-hidden="true" />
+            )}
+            {confirmLabel}
+          </Button>
+        </DialogFooter>
+      </DialogContent>
+    </Dialog>
+  )
+}
\ No newline at end of file
-- 
cgit v1.2.3

