Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const SignInSocialButtons = React.memo((props: SignInSocialButtonsProps)
return (
<SocialButtons
{...rest}
showLastAuthenticationStrategy={true}
showLastAuthenticationStrategy
idleAfterDelay={!shouldUsePopup}
oauthCallback={strategy => {
if (shouldUsePopup) {
Expand Down
10 changes: 7 additions & 3 deletions packages/clerk-js/src/ui/elements/SocialButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
);
const strategyRowOneLength = strategyRows.at(lastAuthenticationStrategyPresent ? 1 : 0)?.length ?? 0;

const remainingStrategiesCount = lastAuthenticationStrategy ? strategies.length - 1 : strategies.length;

const preferBlockButtons =
socialButtonsVariant === 'blockButton'
? true
: socialButtonsVariant === 'iconButton'
? false
: strategies.length <= SOCIAL_BUTTON_BLOCK_THRESHOLD;
: remainingStrategiesCount <= SOCIAL_BUTTON_BLOCK_THRESHOLD;

const startOauth = async (strategy: OAuthStrategy | Web3Strategy) => {
card.setLoading(strategy);
Expand Down Expand Up @@ -160,13 +162,15 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
})}
>
{row.map(strategy => {
const isLastAuthButton = strategy === lastAuthenticationStrategy;

const label =
strategies.length === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
isLastAuthButton || remainingStrategiesCount === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
? `Continue with ${strategyToDisplayData[strategy].name}`
: strategyToDisplayData[strategy].name;

const localizedText =
strategies.length === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
isLastAuthButton || remainingStrategiesCount === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
? localizationKeys('socialButtonsBlockButton', {
provider: strategyToDisplayData[strategy].name,
})
Expand Down
Loading
Loading