From f7f363b7c17a14ca30ffea753ae1fbf836e47d20 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Mon, 26 Jun 2023 16:36:10 -0400 Subject: [PATCH] fix(striker-ui): simplify frequently used props of build delete dialog in checklist --- striker-ui/hooks/useChecklist.tsx | 10 +++++++++- striker-ui/types/Checklist.d.ts | 13 ++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/striker-ui/hooks/useChecklist.tsx b/striker-ui/hooks/useChecklist.tsx index b8938768..c30cef71 100644 --- a/striker-ui/hooks/useChecklist.tsx +++ b/striker-ui/hooks/useChecklist.tsx @@ -36,11 +36,19 @@ const useChecklist = ({ confirmDialogProps = {}, formSummaryProps = {}, getConfirmDialogTitle, + onProceedAppend, + renderEntry, }) => ({ actionProceedText: 'Delete', content: ( - + ), + onProceedAppend, proceedColour: 'red', titleText: getConfirmDialogTitle(checks.length), ...confirmDialogProps, diff --git a/striker-ui/types/Checklist.d.ts b/striker-ui/types/Checklist.d.ts index 5e5a0f13..e0474620 100644 --- a/striker-ui/types/Checklist.d.ts +++ b/striker-ui/types/Checklist.d.ts @@ -2,11 +2,14 @@ type Checklist = Record; type ArrayChecklist = (keyof Checklist)[]; -type BuildDeleteDialogPropsFunction = (args: { - confirmDialogProps?: Partial>; - formSummaryProps?: Omit, 'entries'>; - getConfirmDialogTitle: (length: number) => ReactNode; -}) => ConfirmDialogProps; +type BuildDeleteDialogPropsFunction = ( + args: { + confirmDialogProps?: Partial>; + formSummaryProps?: Omit, 'entries'>; + getConfirmDialogTitle: (length: number) => ReactNode; + } & Pick & + Pick, 'renderEntry'>, +) => ConfirmDialogProps; type GetCheckFunction = (key: string) => boolean;