Skip to content

Commit

Permalink
Fixed separator when only Passkey is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hopleus committed Jan 10, 2025
1 parent 8cb4f01 commit 6e4cd8c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/stack/src/components-page/auth-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ function Inner (props: Props) {
return <PredefinedMessageCard type='signUpDisabled' fullPage={props.fullPage} />;
}

const enableSeparator = (project.config.credentialEnabled || project.config.magicLinkEnabled) && project.config.oauthProviders.length > 0;
const hasOAuthProviders = project.config.oauthProviders.length > 0;
const hasPasskey = (project.config.passkeyEnabled === true && props.type === "sign-in");
const enableSeparator = (project.config.credentialEnabled || project.config.magicLinkEnabled) && (hasOAuthProviders || hasPasskey);

return (
<MaybeFullPage fullPage={!!props.fullPage}>
Expand Down Expand Up @@ -114,10 +116,12 @@ function Inner (props: Props) {
</Typography>
)}
</div>
<div className='gap-4 flex flex-col items-stretch stack-scope'>
<OAuthButtonGroup type={props.type} mockProject={props.mockProject} />
{project.config.passkeyEnabled && props.type === "sign-in" && <PasskeyButton type={props.type} />}
</div>
{(hasOAuthProviders || hasPasskey) && (
<div className='gap-4 flex flex-col items-stretch stack-scope'>
{hasOAuthProviders && <OAuthButtonGroup type={props.type} mockProject={props.mockProject} />}
{hasPasskey && <PasskeyButton type={props.type} />}
</div>
)}

{enableSeparator && <SeparatorWithText text={t('Or continue with')} />}
{project.config.credentialEnabled && project.config.magicLinkEnabled ? (
Expand All @@ -139,9 +143,12 @@ function Inner (props: Props) {
props.type === 'sign-up' ? <CredentialSignUp noPasswordRepeat={props.noPasswordRepeat} /> : <CredentialSignIn/>
) : project.config.magicLinkEnabled ? (
<MagicLinkSignIn/>
) : project.config.oauthProviders.length === 0 ? <Typography variant={"destructive"} className="text-center">{t("No authentication method enabled.")}</Typography> : null}
) : !(hasOAuthProviders || hasPasskey) ? <Typography variant={"destructive"} className="text-center">{t("No authentication method enabled.")}</Typography> : null}
{props.extraInfo && (
<div className='flex flex-col items-center text-center text-sm text-gray-500 mt-2'>
<div className={cn('flex flex-col items-center text-center text-sm text-gray-500', {
'mt-2': project.config.credentialEnabled || project.config.magicLinkEnabled,
'mt-6': !(project.config.credentialEnabled || project.config.magicLinkEnabled),
})}>
<div>{props.extraInfo}</div>
</div>
)}
Expand Down

0 comments on commit 6e4cd8c

Please sign in to comment.