From 5826c9728480e92e6c1bfeef787c9125df8c7653 Mon Sep 17 00:00:00 2001 From: Przemek Date: Thu, 18 Apr 2024 14:43:28 +0200 Subject: [PATCH] custom submit text in login and register --- src/components/organisms/LoginForm/LoginForm.tsx | 4 +++- src/components/organisms/RegisterForm/RegisterForm.tsx | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/LoginForm/LoginForm.tsx b/src/components/organisms/LoginForm/LoginForm.tsx index 57e95623..e6fa8581 100644 --- a/src/components/organisms/LoginForm/LoginForm.tsx +++ b/src/components/organisms/LoginForm/LoginForm.tsx @@ -67,6 +67,7 @@ interface Props extends ExtendableStyledComponent { onResetPasswordLink?: () => void; onRegisterLink?: () => void; mobile?: boolean; + submitText?: string; } export const LoginForm: React.FC = ({ @@ -76,6 +77,7 @@ export const LoginForm: React.FC = ({ onRegisterLink, mobile = false, className = "", + submitText, }) => { const initialValues: MyFormValues = { email: "", @@ -203,7 +205,7 @@ export const LoginForm: React.FC = ({ mode={"outline"} onClick={() => onRegisterLink && onRegisterLink()} > - {t("Login.Signup")} + {submitText ? submitText : t("Login.Signup")} ); diff --git a/src/components/organisms/RegisterForm/RegisterForm.tsx b/src/components/organisms/RegisterForm/RegisterForm.tsx index 8e87d376..24b0ff3a 100644 --- a/src/components/organisms/RegisterForm/RegisterForm.tsx +++ b/src/components/organisms/RegisterForm/RegisterForm.tsx @@ -104,6 +104,7 @@ export interface RegisterFormProps extends ExtendableStyledComponent { return_url?: string; /** Additional labels you can overwrite fields labels. Usable for additional fields. */ fieldLabels?: Record; + submitText?: string; } export const RegisterForm: React.FC = ({ @@ -114,6 +115,7 @@ export const RegisterForm: React.FC = ({ return_url = "", fieldLabels = {}, className = "", + submitText, }) => { const [initialValues, setInitialValues] = useState< FormValues & Record @@ -173,7 +175,7 @@ export const RegisterForm: React.FC = ({ return ( - {t<string>("RegisterForm.Header")} + {submitText ? submitText : t<string>("RegisterForm.Header")} {t("RegisterForm.Subtitle")} = ({ ))} )}