Skip to content

Commit 0b70ce8

Browse files
committed
Fix theme in select-sell ui
1 parent ad7daa8 commit 0b70ce8

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-sell-token.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
iconSize,
1313
radius,
1414
spacing,
15+
type Theme,
1516
} from "../../../../core/design-system/index.js";
1617
import { ConnectButton } from "../../ConnectWallet/ConnectButton.js";
1718
import { formatTokenAmount } from "../../ConnectWallet/screens/formatTokenBalance.js";
@@ -46,6 +47,7 @@ function getDefaultSelectedChain(
4647
export function SelectSellToken(
4748
props: SelectSellTokenProps & {
4849
activeWalletInfo: ActiveWalletInfo | undefined;
50+
theme: Theme | "light" | "dark";
4951
},
5052
) {
5153
if (props.activeWalletInfo) {
@@ -60,13 +62,15 @@ export function SelectSellToken(
6062
<SelectSellTokenDisconnectedUI
6163
onBack={props.onBack}
6264
client={props.client}
65+
theme={props.theme}
6366
/>
6467
);
6568
}
6669

6770
export function SelectSellTokenDisconnectedUI(props: {
6871
onBack: () => void;
6972
client: ThirdwebClient;
73+
theme: Theme | "light" | "dark";
7074
}) {
7175
return (
7276
<Container>
@@ -111,6 +115,7 @@ export function SelectSellTokenDisconnectedUI(props: {
111115
<ConnectButton
112116
client={props.client}
113117
connectButton={{ style: { width: "100%" }, label: "Connect Wallet" }}
118+
theme={props.theme}
114119
/>
115120
</Container>
116121
</Container>

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export function SwapUI(props: SwapUIProps) {
184184
onBack={() => setScreen("base")}
185185
client={props.client}
186186
selectedToken={sellToken}
187+
theme={props.theme}
187188
setSelectedToken={(token) => {
188189
setSellToken(token);
189190
setScreen("base");

packages/thirdweb/src/stories/Bridge/Swap/SelectSellToken.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export function ChainLoading() {
7272
export function Disconnected() {
7373
return (
7474
<SwapWidgetContainer theme="dark" className="w-full">
75-
<SelectSellTokenDisconnectedUI client={storyClient} onBack={() => {}} />
75+
<SelectSellTokenDisconnectedUI
76+
client={storyClient}
77+
onBack={() => {}}
78+
theme="dark"
79+
/>
7680
</SwapWidgetContainer>
7781
);
7882
}

packages/thirdweb/src/stories/Bridge/Swap/SwapWidget.stories.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Meta } from "@storybook/react-vite";
2+
import { lightTheme } from "../../../react/core/design-system/index.js";
23
import { SwapWidget } from "../../../react/web/ui/Bridge/swap-widget/SwapWidget.js";
34
import { storyClient } from "../../utils.js";
45

@@ -21,3 +22,21 @@ export function CurrencySet() {
2122
export function LightMode() {
2223
return <SwapWidget client={storyClient} currency="JPY" theme="light" />;
2324
}
25+
26+
export function CustomTheme() {
27+
return (
28+
<SwapWidget
29+
client={storyClient}
30+
currency="JPY"
31+
theme={lightTheme({
32+
colors: {
33+
modalBg: "#FFFFF0",
34+
tertiaryBg: "#DBE4C9",
35+
borderColor: "#8AA624",
36+
secondaryText: "#3E3F29",
37+
accentText: "#E43636",
38+
},
39+
})}
40+
/>
41+
);
42+
}

0 commit comments

Comments
 (0)