-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.tsx
126 lines (113 loc) · 3.54 KB
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"use client";
import Image from "next/image";
import { ConnectButton, useActiveWallet } from "thirdweb/react";
import thirdwebIcon from "@public/thirdweb.svg";
import { client } from "../client";
import { ozean, sepolia } from "../chains";
export default function Home() {
const wallet = useActiveWallet()
return (
<main className="p-4 pb-10 min-h-[100vh] flex items-center justify-center container max-w-screen-lg mx-auto">
<div className="py-20">
<Header />
<div className="flex justify-center flex-col items-center gap-6 mb-20">
<ConnectButton
client={client}
appMetadata={{
name: "Example App",
url: "https://example.com",
}}
chain={ozean}
chains={[sepolia, ozean]}
/>
<div className="flex items-center gap-4">
<button
onClick={async () => {
console.log('switching to sepolia...')
await wallet?.switchChain(sepolia)
console.log('finish switch chain')
}}
>
Switch to Sepolia
</button>
<button
onClick={async () => {
console.log('switching to ozean...')
await wallet?.switchChain(ozean)
console.log('finish switch chain')
}}
>
Switch to Ozean
</button>
</div>
</div>
<ThirdwebResources />
</div>
</main>
);
}
function Header() {
return (
<header className="flex flex-col items-center mb-20 md:mb-20">
<Image
src={thirdwebIcon}
alt=""
className="size-[150px] md:size-[150px]"
style={{
filter: "drop-shadow(0px 0px 24px #a726a9a8)",
}}
/>
<h1 className="text-2xl md:text-6xl font-semibold md:font-bold tracking-tighter mb-6 text-zinc-100">
thirdweb SDK
<span className="text-zinc-300 inline-block mx-1"> + </span>
<span className="inline-block -skew-x-6 text-blue-500"> Next.js </span>
</h1>
<p className="text-zinc-300 text-base">
Read the{" "}
<code className="bg-zinc-800 text-zinc-300 px-2 rounded py-1 text-sm mx-1">
README.md
</code>{" "}
file to get started.
</p>
</header>
);
}
function ThirdwebResources() {
return (
<div className="grid gap-4 lg:grid-cols-3 justify-center">
<ArticleCard
title="thirdweb SDK Docs"
href="https://portal.thirdweb.com/typescript/v5"
description="thirdweb TypeScript SDK documentation"
/>
<ArticleCard
title="Components and Hooks"
href="https://portal.thirdweb.com/typescript/v5/react"
description="Learn about the thirdweb React components and hooks in thirdweb SDK"
/>
<ArticleCard
title="thirdweb Dashboard"
href="https://thirdweb.com/dashboard"
description="Deploy, configure, and manage your smart contracts from the dashboard."
/>
</div>
);
}
function ArticleCard(props: {
title: string;
href: string;
description: string;
}) {
return (
<a
href={props.href + "?utm_source=next-template"}
target="_blank"
className="flex flex-col border border-zinc-800 p-4 rounded-lg hover:bg-zinc-900 transition-colors hover:border-zinc-700"
>
<article>
<h2 className="text-lg font-semibold mb-2">{props.title}</h2>
<p className="text-sm text-zinc-400">{props.description}</p>
</article>
</a>
);
}