27 lines
866 B
TypeScript
27 lines
866 B
TypeScript
import { useConfirm } from "./confirm";
|
|
import { usePrompt } from "./prompt";
|
|
|
|
export function useDialogActions() {
|
|
const { confirm } = useConfirm();
|
|
const { prompt } = usePrompt();
|
|
|
|
return {
|
|
confirmAction: (message: string, options?: { title?: string; confirmLabel?: string; cancelLabel?: string; destructive?: boolean }) =>
|
|
confirm({
|
|
message,
|
|
title: options?.title,
|
|
confirmLabel: options?.confirmLabel,
|
|
cancelLabel: options?.cancelLabel,
|
|
destructive: options?.destructive,
|
|
}),
|
|
promptForValue: (message: string, defaultValue = "", options?: { title?: string; confirmLabel?: string; cancelLabel?: string }) =>
|
|
prompt({
|
|
message,
|
|
defaultValue,
|
|
title: options?.title,
|
|
confirmLabel: options?.confirmLabel,
|
|
cancelLabel: options?.cancelLabel,
|
|
}),
|
|
};
|
|
}
|