Skip to content

Commit 7f35b15

Browse files
Make continue without passkey a separate component
1 parent 64da711 commit 7f35b15

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.
2+
*
3+
* This software is licensed under the Apache License, Version 2.0 (the
4+
* "License") as published by the Apache Software Foundation.
5+
*
6+
* You may not use this file except in compliance with the License. You may
7+
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
* License for the specific language governing permissions and limitations
13+
* under the License.
14+
*/
15+
16+
import { withOverride } from "../../../../../components/componentOverride/withOverride";
17+
import { useTranslation } from "../../../../../translation/translationContext";
18+
19+
export const ContinueWithoutPasskey = withOverride(
20+
"continueWithoutPasskey",
21+
function ContinueWithoutPasskeyButton(props: { onClick: () => void }): JSX.Element {
22+
const t = useTranslation();
23+
24+
return (
25+
<div data-supertokens="continueWithoutPasskey">
26+
<a onClick={props.onClick} data-supertokens="formLabelLinkBtn continueWithoutPasskeyLabel">
27+
{t("WEBAUTHN_CONTINUE_WITHOUT_PASSKEY_BUTTON")}
28+
</a>
29+
</div>
30+
);
31+
}
32+
);

lib/ts/recipe/webauthn/components/themes/signUp/signUpForm.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,19 @@ import { Label } from "../../../../emailpassword/components/library";
2121
import FormBase from "../../../../emailpassword/components/library/formBase";
2222
import { defaultEmailValidator } from "../../../../emailpassword/validators";
2323

24+
import { ContinueWithoutPasskey } from "./continueWithoutPasskey";
25+
2426
import type { SignUpFormProps } from "../../../types";
2527

2628
export const SignUpForm = withOverride(
2729
"PasskeySignUpForm",
28-
function PasswordlessEmailForm(
30+
function PasskeyEmailForm(
2931
props: SignUpFormProps & {
3032
footer?: JSX.Element;
3133
}
3234
): JSX.Element {
3335
const t = useTranslation();
34-
35-
const defaultFooter = (
36-
<div data-supertokens="continueWithoutPasskey">
37-
<a onClick={props.resetFactorList} data-supertokens="formLabelLinkBtn continueWithoutPasskeyLabel">
38-
{t("WEBAUTHN_CONTINUE_WITHOUT_PASSKEY_BUTTON")}
39-
</a>
40-
</div>
41-
);
36+
const defaultFooter = <ContinueWithoutPasskey onClick={props.resetFactorList} />;
4237

4338
return (
4439
<FormBase

0 commit comments

Comments
 (0)