|
1 | | -import { ExternalLinkIcon } from "lucide-react"; |
2 | | -import Link from "next/link"; |
3 | | -import type { ThirdwebClient } from "thirdweb"; |
| 1 | +import { defineChain, type ThirdwebClient } from "thirdweb"; |
4 | 2 | import type { ChainMetadata } from "thirdweb/chains"; |
5 | | -import { ChainIcon } from "../../../../components/server/chain-icon"; |
6 | | -import { PayModalButton } from "../client/PayModal"; |
7 | | -import { CreditCardIcon } from "../icons/CreditCardIcon"; |
8 | 3 | import { SectionTitle } from "./SectionTitle"; |
| 4 | +import { BuyWidget } from "thirdweb/react"; |
9 | 5 |
|
10 | 6 | export function BuyFundsSection(props: { |
11 | 7 | chain: ChainMetadata; |
12 | 8 | client: ThirdwebClient; |
13 | 9 | }) { |
14 | | - const sanitizedChainName = props.chain.name.replace("Mainnet", "").trim(); |
15 | | - |
16 | 10 | return ( |
17 | | - <section> |
| 11 | + <section className="flex flex-col gap-4 items-center justify-center"> |
18 | 12 | <SectionTitle title="Bridge" /> |
19 | | - <div className="flex justify-center rounded-lg border border-border bg-card px-4 py-10"> |
20 | | - <div className="flex max-w-[520px] flex-col items-center "> |
21 | | - <div className="flex items-center"> |
22 | | - <ChainIcon |
23 | | - className="-mr-2 size-12 rounded-full border p-1" |
24 | | - iconUrl={props.chain.icon?.url} |
25 | | - /> |
26 | | - <CreditCardIcon |
27 | | - bg="hsl(var(--background))" |
28 | | - className="-ml-2 size-12" |
29 | | - /> |
30 | | - </div> |
31 | | - |
32 | | - <div className="h-6" /> |
33 | | - |
34 | | - <h2 className="px-4 text-center font-semibold text-lg tracking-tight"> |
35 | | - Bridge Funds to {sanitizedChainName} |
36 | | - </h2> |
37 | | - |
38 | | - <div className="h-2" /> |
39 | | - |
40 | | - <p className="max-w-[520px] px-4 text-center text-muted-foreground text-sm"> |
41 | | - Get {props.chain.nativeCurrency.symbol} on {sanitizedChainName} with |
42 | | - fiat or any token on another chain. |
43 | | - </p> |
44 | | - |
45 | | - <div className="h-8" /> |
46 | | - |
47 | | - <PayModalButton |
48 | | - chainId={props.chain.chainId} |
49 | | - client={props.client} |
50 | | - label={`Bridge to ${sanitizedChainName}`} |
51 | | - /> |
52 | | - |
53 | | - <div className="h-4" /> |
54 | | - |
55 | | - <Link |
56 | | - className="inline-flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground" |
57 | | - href="https://portal.thirdweb.com/connect/pay/overview" |
58 | | - rel="noopener noreferrer" |
59 | | - target="_blank" |
60 | | - > |
61 | | - Learn more about Universal Bridge |
62 | | - <ExternalLinkIcon className="size-3" /> |
63 | | - </Link> |
64 | | - </div> |
65 | | - </div> |
| 13 | + <BuyWidget |
| 14 | + client={props.client} |
| 15 | + chain={defineChain(props.chain.chainId)} |
| 16 | + amount="0.01" |
| 17 | + /> |
66 | 18 | </section> |
67 | 19 | ); |
68 | 20 | } |
0 commit comments