Skip to content

Commit 56a1c0a

Browse files
committed
[MNY-341] Payment Details UI improvements (#8576)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving the Payment Details UI for bridge widget components in the `thirdweb` package, enhancing layout, styling, and functionality. ### Detailed summary - Adjusted `padding` in `TokenBalanceRow.tsx`. - Replaced `OutlineWalletIcon` with a styled `Container` in `WalletRow.tsx`. - Updated `borderRadius` and `borderBottom` styles in `PaymentOverview.tsx`. - Enhanced `StepConnectorArrow` styles and added `iconSize` for `ChevronDownIcon`. - Modified `OutlineWalletIcon` definition to accept `size`, `color`, and `style` props. - Refactored `cryptoPaymentMethod` and `ethCryptoPaymentMethod` structures for clarity. - Updated `PaymentDetails.tsx` styles, including `gap`, `borderRadius`, and button styles. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved bridge payment details UI with enhanced spacing, borders, and styling * Updated wallet row display with better visual presentation when disconnected * Refined typography and color usage across payment interface components * Enhanced border radius and padding consistency throughout bridge widget <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 6e87b92 commit 56a1c0a

8 files changed

Lines changed: 112 additions & 68 deletions

File tree

.changeset/yummy-squids-rush.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+
Payment Details UI improvements for bridge widget components

packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function TokenBalanceRow({
3333
style={{
3434
display: "flex",
3535
justifyContent: "space-between",
36-
padding: `${spacing.sm} ${spacing.md}`,
36+
padding: `${spacing.md} ${spacing.md}`,
3737
...style,
3838
}}
3939
variant="secondary"

packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { defineChain } from "../../../../../chains/utils.js";
44
import type { ThirdwebClient } from "../../../../../client/client.js";
55
import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
66
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
7-
import { radius, spacing } from "../../../../core/design-system/index.js";
7+
import {
8+
iconSize,
9+
radius,
10+
spacing,
11+
} from "../../../../core/design-system/index.js";
812
import { useChainsQuery } from "../../../../core/hooks/others/useChainQuery.js";
913
import type { BridgePrepareResult } from "../../../../core/hooks/useBridgePrepare.js";
1014
import {
@@ -306,12 +310,12 @@ export function PaymentDetails({
306310

307311
<Container
308312
flex="column"
309-
gap="sm"
313+
gap="md+"
310314
style={{
311315
backgroundColor: theme.colors.tertiaryBg,
312316
border: `1px solid ${theme.colors.borderColor}`,
313-
borderRadius: radius.md,
314-
padding: `${spacing.sm} ${spacing.md}`,
317+
borderRadius: radius.xl,
318+
padding: `${spacing.md} ${spacing.md}`,
315319
}}
316320
>
317321
{preparedQuote.steps.map((step, stepIndex) => (
@@ -323,24 +327,24 @@ export function PaymentDetails({
323327
{/* Step Header */}
324328
<Container
325329
flex="row"
326-
gap="md"
330+
gap="sm"
327331
style={{ alignItems: "center" }}
328332
>
329333
<Container
330334
center="both"
331335
flex="row"
332336
style={{
333-
backgroundColor: theme.colors.accentButtonBg,
334-
borderRadius: "50%",
335-
color: theme.colors.accentButtonText,
337+
backgroundColor: theme.colors.modalBg,
338+
border: `1px solid ${theme.colors.borderColor}`,
339+
borderRadius: radius.full,
340+
color: theme.colors.secondaryText,
336341
flexShrink: 0,
337-
fontSize: "12px",
338342
fontWeight: "bold",
339-
height: "24px",
340-
width: "24px",
343+
height: `${iconSize.lg}px`,
344+
width: `${iconSize.lg}px`,
341345
}}
342346
>
343-
<Text color="accentButtonText" size="xs">
347+
<Text color="secondaryText" size="sm">
344348
{stepIndex + 1}
345349
</Text>
346350
</Container>
@@ -352,7 +356,7 @@ export function PaymentDetails({
352356
style={{ flex: 1 }}
353357
>
354358
<Container flex="column" gap="3xs" style={{ flex: 1 }}>
355-
<Text color="primaryText" size="sm">
359+
<Text color="primaryText" size="sm" weight={500}>
356360
{step.destinationToken.chainId !==
357361
step.originToken.chainId ? (
358362
<>
@@ -401,11 +405,16 @@ export function PaymentDetails({
401405
</Container>
402406
)}
403407

404-
<Spacer y="lg" />
408+
<Spacer y="md" />
405409

406410
{/* Action Buttons */}
407411
<Container flex="column" gap="sm">
408-
<Button fullWidth onClick={handleConfirm} variant="accent">
412+
<Button
413+
fullWidth
414+
onClick={handleConfirm}
415+
variant="primary"
416+
style={{ borderRadius: radius.full }}
417+
>
409418
{confirmButtonLabel || "Confirm Payment"}
410419
</Button>
411420
</Container>

packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ export function PaymentOverview(props: {
4747
flex="column"
4848
style={{
4949
border: `1px solid ${theme.colors.borderColor}`,
50-
borderRadius: radius.lg,
50+
borderRadius: radius.xl,
5151
}}
5252
>
5353
{sender && (
5454
<Container
5555
flex="row"
5656
gap="sm"
5757
px="md"
58-
py="sm"
58+
py="md"
5959
style={{
60-
borderBottom: `1px solid ${theme.colors.borderColor}`,
60+
borderBottom: `1px dashed ${theme.colors.borderColor}`,
6161
}}
6262
>
6363
<WalletRow
@@ -88,7 +88,7 @@ export function PaymentOverview(props: {
8888
flex="row"
8989
gap="sm"
9090
px="md"
91-
py="sm"
91+
py="md"
9292
style={{ justifyContent: "space-between" }}
9393
>
9494
{/* left */}
@@ -122,17 +122,17 @@ export function PaymentOverview(props: {
122122
flex="column"
123123
style={{
124124
border: `1px solid ${theme.colors.borderColor}`,
125-
borderRadius: radius.lg,
125+
borderRadius: radius.xl,
126126
}}
127127
>
128128
{isDifferentRecipient && (
129129
<Container
130130
flex="row"
131131
gap="sm"
132132
px="md"
133-
py="sm"
133+
py="md"
134134
style={{
135-
borderBottom: `1px solid ${theme.colors.borderColor}`,
135+
borderBottom: `1px dashed ${theme.colors.borderColor}`,
136136
}}
137137
>
138138
<WalletRow

packages/thirdweb/src/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import type { IconFC } from "./types.js";
2-
31
/**
42
* @internal
53
*/
6-
export const OutlineWalletIcon: IconFC = (props) => {
4+
export const OutlineWalletIcon = (props: {
5+
size?: string;
6+
color?: string;
7+
style?: React.CSSProperties;
8+
}) => {
79
return (
810
<svg
911
fill="none"
@@ -12,6 +14,7 @@ export const OutlineWalletIcon: IconFC = (props) => {
1214
viewBox="0 0 24 24"
1315
width={props.size}
1416
xmlns="http://www.w3.org/2000/svg"
17+
style={props.style}
1518
>
1619
<path
1720
d="M19 7V4C19 3.73478 18.8946 3.48043 18.7071 3.29289C18.5196 3.10536 18.2652 3 18 3H5C4.46957 3 3.96086 3.21071 3.58579 3.58579C3.21071 3.96086 3 4.46957 3 5C3 5.53043 3.21071 6.03914 3.58579 6.41421C3.96086 6.78929 4.46957 7 5 7H20C20.2652 7 20.5196 7.10536 20.7071 7.29289C20.8946 7.48043 21 7.73478 21 8V12M21 12H18C17.4696 12 16.9609 12.2107 16.5858 12.5858C16.2107 12.9609 16 13.4696 16 14C16 14.5304 16.2107 15.0391 16.5858 15.4142C16.9609 15.7893 17.4696 16 18 16H21C21.2652 16 21.5196 15.8946 21.7071 15.7071C21.8946 15.5196 22 15.2652 22 15V13C22 12.7348 21.8946 12.4804 21.7071 12.2929C21.5196 12.1054 21.2652 12 21 12Z"

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { ChevronDownIcon } from "@radix-ui/react-icons";
22
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
3+
import {
4+
iconSize,
5+
radius,
6+
} from "../../../../../../core/design-system/index.js";
37
import { Container } from "../../../../components/basic.js";
48

59
export function StepConnectorArrow() {
@@ -9,26 +13,25 @@ export function StepConnectorArrow() {
913
center="both"
1014
flex="row"
1115
style={{
12-
marginBottom: "-10px",
13-
marginTop: "-10px",
16+
marginBottom: "-12px",
17+
marginTop: "-12px",
1418
position: "relative",
1519
width: "100%",
1620
zIndex: 1000,
1721
}}
1822
>
1923
<Container
2024
center="both"
21-
color="primaryText"
25+
color="secondaryText"
2226
flex="row"
2327
style={{
2428
backgroundColor: theme.colors.modalBg,
2529
border: `1px solid ${theme.colors.borderColor}`,
26-
borderRadius: "100%",
27-
height: "30px",
28-
width: "30px",
30+
borderRadius: radius.full,
31+
padding: "6px",
2932
}}
3033
>
31-
<ChevronDownIcon height={16} width={16} />
34+
<ChevronDownIcon height={iconSize["sm+"]} width={iconSize["sm+"]} />
3235
</Container>
3336
</Container>
3437
);

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { isSmartWallet } from "../../../../../../../wallets/smart/index.js";
55
import {
66
fontSize,
77
iconSize,
8+
radius,
89
} from "../../../../../../core/design-system/index.js";
910
import { useConnectedWallets } from "../../../../../../core/hooks/wallets/useConnectedWallets.js";
1011
import {
@@ -58,7 +59,27 @@ export function WalletRow(props: {
5859
size={iconSizeValue}
5960
/>
6061
) : (
61-
<OutlineWalletIcon size={iconSizeValue} />
62+
<Container
63+
borderColor="borderColor"
64+
bg="modalBg"
65+
flex="row"
66+
center="both"
67+
style={{
68+
borderStyle: "solid",
69+
borderWidth: "1px",
70+
borderRadius: radius.full,
71+
width: `${iconSizeValue}px`,
72+
height: `${iconSizeValue}px`,
73+
position: "relative",
74+
}}
75+
>
76+
<OutlineWalletIcon
77+
style={{
78+
position: "absolute",
79+
inset: "25%",
80+
}}
81+
/>
82+
</Container>
6283
)}
6384
<Container flex="column" gap="3xs">
6485
{props.label ? (

packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22
import { PaymentDetails } from "../../react/web/ui/Bridge/payment-details/PaymentDetails.js";
33
import type { PaymentMethod } from "../../react/web/ui/Bridge/types.js";
4-
import { stringify } from "../../utils/json.js";
54
import { ModalThemeWrapper, storyClient } from "../utils.js";
65
import {
76
buyWithApprovalQuote,
@@ -22,41 +21,45 @@ const fiatPaymentMethod: PaymentMethod = {
2221
type: "fiat",
2322
};
2423

25-
const cryptoPaymentMethod: PaymentMethod = JSON.parse(
26-
stringify({
27-
balance: 100000000n,
28-
originToken: {
29-
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
30-
chainId: 1,
31-
decimals: 6,
32-
iconUri:
33-
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
34-
name: "USD Coin",
35-
priceUsd: 1.0,
36-
symbol: "USDC",
24+
const cryptoPaymentMethod: PaymentMethod = {
25+
action: "buy",
26+
balance: 100000000n,
27+
hasEnoughBalance: true,
28+
originToken: {
29+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
30+
chainId: 1,
31+
decimals: 6,
32+
iconUri:
33+
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
34+
name: "USD Coin",
35+
prices: {
36+
USD: 1.0,
3737
},
38-
payerWallet: STORY_MOCK_WALLET,
39-
type: "wallet",
40-
}),
41-
);
42-
43-
const ethCryptoPaymentMethod: PaymentMethod = JSON.parse(
44-
stringify({
45-
balance: 1000000000000000000n,
46-
originToken: {
47-
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
48-
chainId: 1,
49-
decimals: 18,
50-
iconUri:
51-
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
52-
name: "Ethereum",
53-
priceUsd: 2500.0,
54-
symbol: "ETH",
38+
symbol: "USDC",
39+
},
40+
payerWallet: STORY_MOCK_WALLET,
41+
type: "wallet",
42+
};
43+
44+
const ethCryptoPaymentMethod: PaymentMethod = {
45+
action: "buy",
46+
balance: 1000000000000000000n,
47+
hasEnoughBalance: true,
48+
originToken: {
49+
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
50+
chainId: 1,
51+
decimals: 18,
52+
iconUri:
53+
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
54+
name: "Ethereum",
55+
prices: {
56+
USD: 2500.0,
5557
},
56-
payerWallet: STORY_MOCK_WALLET,
57-
type: "wallet",
58-
}),
59-
);
58+
symbol: "ETH",
59+
},
60+
payerWallet: STORY_MOCK_WALLET,
61+
type: "wallet",
62+
};
6063

6164
const meta: Meta<typeof PaymentDetails> = {
6265
args: {

0 commit comments

Comments
 (0)