From eb08a0ed146cbaa244c6b037e57587da03730fae Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Sun, 13 Apr 2025 14:06:59 +0530 Subject: [PATCH] fix: buttonLabel conditions (#5336) Co-authored-by: pandeymangg --- packages/surveys/src/components/buttons/back-button.tsx | 2 +- packages/surveys/src/components/buttons/submit-button.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/surveys/src/components/buttons/back-button.tsx b/packages/surveys/src/components/buttons/back-button.tsx index b3917ad124..af0f74d863 100644 --- a/packages/surveys/src/components/buttons/back-button.tsx +++ b/packages/surveys/src/components/buttons/back-button.tsx @@ -16,7 +16,7 @@ export function BackButton({ onClick, backButtonLabel, tabIndex = 2 }: BackButto "fb-border-back-button-border fb-text-heading focus:fb-ring-focus fb-rounded-custom fb-flex fb-items-center fb-border fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2" )} onClick={onClick}> - {backButtonLabel ?? "Back"} + {backButtonLabel || "Back"} ); } diff --git a/packages/surveys/src/components/buttons/submit-button.tsx b/packages/surveys/src/components/buttons/submit-button.tsx index 33905cac85..bf8b522670 100644 --- a/packages/surveys/src/components/buttons/submit-button.tsx +++ b/packages/surveys/src/components/buttons/submit-button.tsx @@ -2,7 +2,7 @@ import { ButtonHTMLAttributes, useRef } from "preact/compat"; import { useCallback, useEffect } from "preact/hooks"; interface SubmitButtonProps extends ButtonHTMLAttributes { - buttonLabel: string | undefined; + buttonLabel?: string; isLastQuestion: boolean; focus?: boolean; } @@ -56,7 +56,7 @@ export function SubmitButton({ className="fb-bg-brand fb-border-submit-button-border fb-text-on-brand focus:fb-ring-focus fb-rounded-custom fb-flex fb-items-center fb-border fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2" onClick={onClick} disabled={disabled}> - {buttonLabel ?? (isLastQuestion ? "Finish" : "Next")} + {buttonLabel || (isLastQuestion ? "Finish" : "Next")} ); }