From b46fbf56ac617128f1b83b292681b2c048fea822 Mon Sep 17 00:00:00 2001 From: Amir Cheikh Date: Tue, 3 Nov 2026 15:30:49 -0500 Subject: [PATCH] Add live and sandbox toggle to rwk demo --- .../src/components/Switch.tsx | 22 ++++++- .../src/components/demo/DemoPanel.tsx | 66 ++++++++++++++----- 2 files changed, 71 insertions(+), 17 deletions(-) diff --git a/examples/demos/with-react-wallet-kit/src/components/Switch.tsx b/examples/demos/with-react-wallet-kit/src/components/Switch.tsx index 7a81771d5..562f0998e 100644 --- a/examples/demos/with-react-wallet-kit/src/components/Switch.tsx +++ b/examples/demos/with-react-wallet-kit/src/components/Switch.tsx @@ -7,11 +7,20 @@ interface ToggleSwitchProps { disabled?: boolean; size?: "sm" | "md"; label?: string; + subLabel?: string; tooltip?: string; } export function ToggleSwitch(props: ToggleSwitchProps) { - const { checked, onChange, size = "md", disabled, label, tooltip } = props; + const { + checked, + onChange, + size = "md", + disabled, + label, + subLabel, + tooltip, + } = props; const height = size === "sm" ? "h-4.5" : "h-5.5"; const width = size === "sm" ? "w-8" : "w-10"; const knobSize = size === "sm" ? "h-3 w-3" : "h-4 w-4"; @@ -29,7 +38,16 @@ export function ToggleSwitch(props: ToggleSwitchProps) { disabled && "opacity-50 cursor-not-allowed", )} > - {label && {label}} + {(label || subLabel) && ( +
+ {label && {label}} + {subLabel && ( + + {subLabel} + + )} +
+ )} ( [], ); // Initialize with an empty array + const [sandboxMode, setSandboxMode] = useState(true); useEffect(() => { const getConnectedWalletIcons = async (): Promise => { @@ -113,8 +115,10 @@ export default function DemoPanel() { try { await handleOnRamp({ walletAccount: selectedWalletAccount!, - sandboxMode: true, + sandboxMode, defaultFiatCurrencyAmount: "40", + countryCode: "US", + countrySubdivisionCode: "OR", }); } catch (error) { handleError(error); @@ -125,8 +129,10 @@ export default function DemoPanel() { try { await handleOffRamp({ walletAccount: selectedWalletAccount!, - sandboxMode: true, + sandboxMode, defaultCryptoAmount: "0.05", + countryCode: "US", + countrySubdivisionCode: "OR", }); } catch (error) { handleError(error); @@ -409,19 +415,25 @@ export default function DemoPanel() { Sign Message -
- - +
+ +
+ + +
{selectedWallet?.source === WalletSource.Embedded && ( <> @@ -475,6 +487,30 @@ export default function DemoPanel() { ); } +const FundingModeToggle = ({ + sandboxMode, + onChange, +}: { + sandboxMode: boolean; + onChange: (sandboxMode: boolean) => void; +}) => { + return ( +
+ +
+ ); +}; + const StackedImg = ({ connectedWalletIcons, }: {