From 78974dadedb544323d979957b31aa56013076de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Poul=20Kjeldager=20S=C3=B8rensen?= Date: Thu, 12 Sep 2024 07:05:35 +0200 Subject: [PATCH] fix: added way to disable checkmark by setting ending icon to none --- packages/core/src/components/ending/Ending.tsx | 6 ++++-- packages/core/src/model/json-definitions/Layout.ts | 2 ++ packages/core/src/state/QuickformState.ts | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/ending/Ending.tsx b/packages/core/src/components/ending/Ending.tsx index 2861017..f215f0a 100644 --- a/packages/core/src/components/ending/Ending.tsx +++ b/packages/core/src/components/ending/Ending.tsx @@ -22,7 +22,9 @@ const useEndingStyles = makeStyles({ }); export const Ending: React.FC = ({ model, className }) => { - const { state } = useQuickForm(); + const { state } = useQuickForm(); + + const { text, paragraph } = model; const submitStatus = state.submitStatus; const styles = useEndingStyles(); @@ -36,7 +38,7 @@ export const Ending: React.FC = ({ model, className }) => { } {submitStatus.isSubmitSuccess && <> - + {state.defaultEndingSlideIcon !== "none" && } {text && {text} diff --git a/packages/core/src/model/json-definitions/Layout.ts b/packages/core/src/model/json-definitions/Layout.ts index 2e5b2be..30b3569 100644 --- a/packages/core/src/model/json-definitions/Layout.ts +++ b/packages/core/src/model/json-definitions/Layout.ts @@ -7,6 +7,8 @@ export type LayoutDefinition = { * The default text of next button on slides */ defaultNextButtonText?: string; + + defaultEndingSlideIcon?: string; classes?: Partial, style?: React.CSSProperties; tokens?: Partial; diff --git a/packages/core/src/state/QuickformState.ts b/packages/core/src/state/QuickformState.ts index a9dac21..ccc295c 100644 --- a/packages/core/src/state/QuickformState.ts +++ b/packages/core/src/state/QuickformState.ts @@ -13,6 +13,7 @@ export type QuickformClassNames = { ending: string }; export type QuickformState = { + defaultEndingSlideIcon?: string; autoAdvanceSlides?: boolean; enableQuestionNumbers?: boolean; showPressEnter?: boolean; @@ -38,6 +39,7 @@ export type QuickformState = { export const defaultState = (data: QuickFormModel = defaultData, layout?: LayoutDefinition): QuickformState => { const defState = { + defaultEndingSlideIcon: layout?.defaultEndingSlideIcon ?? "checkmark", autoAdvanceSlides: layout?.autoAdvanceSlides ?? false, enableQuestionNumbers: layout?.enableQuestionNumbers ?? false, showPressEnter: layout?.showPressEnter ?? undefined,