Skip to content

Commit 109575e

Browse files
committed
fix(react): update social button styling and behavior logic (#3867)
![Screenshot 2024-07-29 at 5.35.57 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/G5kV6fAq4H1wu10SVop6/b85da5cc-045e-47b9-bde4-e85321c2d802.png) ![Screenshot 2024-07-29 at 4.33.04 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/G5kV6fAq4H1wu10SVop6/36aa163a-2d6a-450f-879f-35a81078360a.png) ![Screenshot 2024-07-29 at 4.30.51 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/G5kV6fAq4H1wu10SVop6/587c10c8-ccd3-4578-a609-83842a037894.png) <!-- start pr-codex --> --- ## PR-Codex overview This PR increases the minimum number of social logins displayed before switching to a different layout. It also adjusts the styling of the social login buttons. ### Detailed summary - Increased minimum social logins displayed to 3 - Adjusted social login buttons layout based on the number of logins - Updated styling for social login buttons to improve alignment and spacing > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent e27ebef commit 109575e

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.changeset/fluffy-snails-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix wallet social login button styling

apps/playground-web/src/lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const WALLETS = [
1515
"passkey",
1616
"phone",
1717
"farcaster",
18+
"facebook",
1819
],
1920
mode: "redirect",
2021
},

packages/thirdweb/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export const ConnectWalletSocialOptions = (
234234
props.select();
235235
}
236236

237-
const showOnlyIcons = socialLogins.length > 1;
237+
const showOnlyIcons = socialLogins.length > 2;
238238

239239
return (
240240
<Container
@@ -247,22 +247,33 @@ export const ConnectWalletSocialOptions = (
247247
{/* Social Login */}
248248
{hasSocialLogins && (
249249
<Container
250-
flex={showOnlyIcons ? "row" : "column"}
250+
flex="row"
251251
center="x"
252-
gap="sm"
252+
gap={socialLogins.length > 4 ? "xs" : "sm"}
253253
style={{
254254
justifyContent: "space-between",
255+
display: "grid",
256+
gridTemplateColumns: `repeat(${socialLogins.length}, 1fr)`,
255257
}}
256258
>
257259
{socialLogins.map((loginMethod) => {
258-
const imgIconSize = showOnlyIcons ? iconSize.lg : iconSize.md;
260+
const imgIconSize = (() => {
261+
if (!showOnlyIcons) {
262+
return iconSize.md;
263+
} else {
264+
if (socialLogins.length > 4) {
265+
return iconSize.md;
266+
}
267+
return iconSize.lg;
268+
}
269+
})();
270+
259271
return (
260272
<SocialButton
261273
aria-label={`Login with ${loginMethod}`}
262274
data-variant={showOnlyIcons ? "icon" : "full"}
263275
key={loginMethod}
264276
variant={"outline"}
265-
fullWidth={!showOnlyIcons}
266277
onClick={() => {
267278
handleSocialLogin(loginMethod as SocialAuthOption);
268279
}}
@@ -274,7 +285,7 @@ export const ConnectWalletSocialOptions = (
274285
client={props.client}
275286
/>
276287
{!showOnlyIcons &&
277-
loginMethodsLabel[loginMethod as SocialAuthOption]}
288+
`${socialLogins.length === 1 ? "Continue with " : ""}${loginMethodsLabel[loginMethod as SocialAuthOption]}`}
278289
</SocialButton>
279290
);
280291
})}
@@ -379,11 +390,12 @@ export const ConnectWalletSocialOptions = (
379390
};
380391

381392
const SocialButton = /* @__PURE__ */ styled(Button)({
393+
flexGrow: 1,
382394
"&[data-variant='full']": {
383395
display: "flex",
384396
justifyContent: "flex-start",
385397
padding: spacing.md,
386-
gap: spacing.md,
398+
gap: spacing.sm,
387399
fontSize: fontSize.md,
388400
fontWeight: 500,
389401
transition: "background-color 0.2s ease",
@@ -393,6 +405,5 @@ const SocialButton = /* @__PURE__ */ styled(Button)({
393405
},
394406
"&[data-variant='icon']": {
395407
padding: spacing.sm,
396-
flexGrow: 1,
397408
},
398409
});

0 commit comments

Comments
 (0)