Skip to content

Commit

Permalink
custom submit text in login and register
Browse files Browse the repository at this point in the history
  • Loading branch information
Przemek committed Apr 18, 2024
1 parent 6fb96dd commit 5826c97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/organisms/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ interface Props extends ExtendableStyledComponent {
onResetPasswordLink?: () => void;
onRegisterLink?: () => void;
mobile?: boolean;
submitText?: string;
}

export const LoginForm: React.FC<Props> = ({
Expand All @@ -76,6 +77,7 @@ export const LoginForm: React.FC<Props> = ({
onRegisterLink,
mobile = false,
className = "",
submitText,
}) => {
const initialValues: MyFormValues = {
email: "",
Expand Down Expand Up @@ -203,7 +205,7 @@ export const LoginForm: React.FC<Props> = ({
mode={"outline"}
onClick={() => onRegisterLink && onRegisterLink()}
>
{t<string>("Login.Signup")}
{submitText ? submitText : t<string>("Login.Signup")}
</Button>
</StyledDiv>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/organisms/RegisterForm/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, React.ReactNode>;
submitText?: string;
}

export const RegisterForm: React.FC<RegisterFormProps> = ({
Expand All @@ -114,6 +115,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
return_url = "",
fieldLabels = {},
className = "",
submitText,
}) => {
const [initialValues, setInitialValues] = useState<
FormValues & Record<string, string | boolean>
Expand Down Expand Up @@ -173,7 +175,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
return (
<StyledDiv className={`wellms-component ${className}`} mobile={mobile}>
<Title level={3} style={{ maxWidth: "480px", textAlign: "center" }}>
{t<string>("RegisterForm.Header")}
{submitText ? submitText : t<string>("RegisterForm.Header")}
</Title>
<Text level={3}>{t<string>("RegisterForm.Subtitle")}</Text>
<Formik
Expand Down Expand Up @@ -369,7 +371,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
))}

<Button mode="primary" type="submit" loading={isSubmitting} block>
{t<string>("Login.Signup")}
{submitText ? submitText : t<string>("Login.Signup")}
</Button>
</form>
)}
Expand Down

0 comments on commit 5826c97

Please sign in to comment.