@@ -100,7 +100,9 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
100100 MAX_STRATEGIES_PER_ROW ,
101101 lastAuthenticationStrategy ,
102102 ) ;
103+ const strategiesCount = lastAuthenticationStrategyPresent ? strategies . length - 1 : strategies . length ;
103104 const strategyRowOneLength = strategyRows . at ( lastAuthenticationStrategyPresent ? 1 : 0 ) ?. length ?? 0 ;
105+ const shouldForceSingleColumnOnMobile = ! lastAuthenticationStrategyPresent && strategies . length === 2 ;
104106
105107 const preferBlockButtons =
106108 socialButtonsVariant === 'blockButton'
@@ -153,8 +155,7 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
153155 [ mqu . sm ] : {
154156 // Force single-column on mobile when 2 strategies are present (without last auth) to prevent
155157 // label overflow. When last auth is present, only 1 strategy remains here, so overflow isn't a concern.
156- gridTemplateColumns :
157- ! lastAuthenticationStrategyPresent && strategies . length === 2 ? 'repeat(1, minmax(0, 1fr))' : undefined ,
158+ gridTemplateColumns : shouldForceSingleColumnOnMobile ? 'repeat(1, minmax(0, 1fr))' : undefined ,
158159 } ,
159160 gridTemplateColumns :
160161 strategies . length < 1
@@ -169,19 +170,21 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
169170 } ) }
170171 >
171172 { row . map ( strategy => {
172- const label =
173- strategies . length === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
174- ? `Continue with ${ strategyToDisplayData [ strategy ] . name } `
175- : strategyToDisplayData [ strategy ] . name ;
173+ const shouldShowPreText =
174+ strategiesCount === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD ||
175+ ( strategy === lastAuthenticationStrategy && row . length === 1 ) ;
176176
177- const localizedText =
178- strategies . length === SOCIAL_BUTTON_PRE_TEXT_THRESHOLD
179- ? localizationKeys ( 'socialButtonsBlockButton' , {
180- provider : strategyToDisplayData [ strategy ] . name ,
181- } )
182- : localizationKeys ( 'socialButtonsBlockButtonManyInView' , {
183- provider : strategyToDisplayData [ strategy ] . name ,
184- } ) ;
177+ const label = shouldShowPreText
178+ ? `Continue with ${ strategyToDisplayData [ strategy ] . name } `
179+ : strategyToDisplayData [ strategy ] . name ;
180+
181+ const localizedText = shouldShowPreText
182+ ? localizationKeys ( 'socialButtonsBlockButton' , {
183+ provider : strategyToDisplayData [ strategy ] . name ,
184+ } )
185+ : localizationKeys ( 'socialButtonsBlockButtonManyInView' , {
186+ provider : strategyToDisplayData [ strategy ] . name ,
187+ } ) ;
185188
186189 const imageOrInitial = strategyToDisplayData [ strategy ] . iconUrl ? (
187190 < Image
0 commit comments