ConfirmDialog: accept confirmTone/confirmLabel/cancelLabel props (P3-57)
This commit is contained in:
1 parent
95c9deb778
commit
96ab72472c
1 file changed
+6
-3
@@ -77,13 +77,16 @@ export function InlineNotice({
|
|||||||
/* ConfirmDialog */
|
/* ConfirmDialog */
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
export function ConfirmDialog({ open, title, message, errorMessage, onConfirm, onCancel }: {
|
export function ConfirmDialog({ open, title, message, errorMessage, onConfirm, onCancel, confirmTone = "danger", confirmLabel = "Confirm", cancelLabel = "Cancel" }: {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
message: string;
|
message: string;
|
||||||
errorMessage?: string | null;
|
errorMessage?: string | null;
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
|
confirmTone?: "default" | "accent" | "danger";
|
||||||
|
confirmLabel?: string;
|
||||||
|
cancelLabel?: string;
|
||||||
}) {
|
}) {
|
||||||
const trapRef = useFocusTrap(open);
|
const trapRef = useFocusTrap(open);
|
||||||
|
|
||||||
@@ -123,8 +126,8 @@ export function ConfirmDialog({ open, title, message, errorMessage, onConfirm, o
|
|||||||
<div className="text-[13px] text-muted-foreground mb-6">{message}</div>
|
<div className="text-[13px] text-muted-foreground mb-6">{message}</div>
|
||||||
{errorMessage ? <div className="mb-4"><InlineNotice message={errorMessage} /></div> : null}
|
{errorMessage ? <div className="mb-4"><InlineNotice message={errorMessage} /></div> : null}
|
||||||
<div className="flex gap-3 justify-end">
|
<div className="flex gap-3 justify-end">
|
||||||
<ActionButton label="Cancel" onClick={onCancel} />
|
<ActionButton label={cancelLabel} onClick={onCancel} />
|
||||||
<ActionButton label="Confirm" tone="danger" onClick={onConfirm} />
|
<ActionButton label={confirmLabel} tone={confirmTone} onClick={onConfirm} />
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|||||||
Reference in new issue
Block a user