Some checks failed
tests / ci (pull_request) Has been cancelled
- Implemented DeleteConfirmDialog for confirming deletions. - Created FormDialog for handling forms within dialogs. - Added PageHeader component for consistent page headers. - Introduced RowActions component for action buttons with tooltips. - Added useServerTable hook for managing server-side table interactions. - Updated DatePicker component with default month and dropdown caption layout. - Removed outdated data.json file.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { ConfirmDialog } from '@/components/confirm-dialog';
|
|
|
|
type DeleteConfirmDialogProps<T> = {
|
|
target: T | null;
|
|
onOpenChange: (open: boolean) => void;
|
|
title: string;
|
|
description?: string | ((target: T) => string);
|
|
confirmLabel?: string;
|
|
variant?: 'default' | 'destructive';
|
|
onConfirm: () => void;
|
|
};
|
|
|
|
export function DeleteConfirmDialog<T>({
|
|
target,
|
|
onOpenChange,
|
|
title,
|
|
description,
|
|
confirmLabel = 'Hapus',
|
|
variant,
|
|
onConfirm,
|
|
}: DeleteConfirmDialogProps<T>) {
|
|
return (
|
|
<ConfirmDialog
|
|
open={target !== null}
|
|
onOpenChange={onOpenChange}
|
|
title={title}
|
|
description={
|
|
typeof description === 'function' && target
|
|
? description(target)
|
|
: typeof description === 'string'
|
|
? description
|
|
: ''
|
|
}
|
|
confirmLabel={confirmLabel}
|
|
variant={variant}
|
|
onConfirm={onConfirm}
|
|
/>
|
|
);
|
|
}
|