1
- "use client" ;
2
-
3
- import { THIRDWEB_CLIENT } from "@/lib/client" ;
4
- import { ethereum } from "thirdweb/chains" ;
5
- import {
6
- AccountAddress ,
7
- AccountAvatar ,
8
- AccountBalance ,
9
- type AccountBalanceInfo ,
10
- AccountBlobbie ,
11
- AccountName ,
12
- AccountProvider ,
13
- } from "thirdweb/react" ;
14
- import { shortenAddress } from "thirdweb/utils" ;
15
1
import { CodeExample } from "../code/code-example" ;
16
-
17
- const vitalikAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" ;
2
+ import {
3
+ AccountAddressBasicPreview ,
4
+ AccountAddressFormatPreview ,
5
+ AccountAvatarBasicPreview ,
6
+ AccountBalanceBasicPreview ,
7
+ AccountBalanceCustomTokenPreview ,
8
+ AccountBalanceFormatPreview ,
9
+ AccountBalanceUSDPreview ,
10
+ AccountBlobbieBasicPreview ,
11
+ AccountNameBasicPreview ,
12
+ AccountNameCustomPreview ,
13
+ ConnectDetailsButtonClonePreview ,
14
+ } from "./account-previews" ;
18
15
19
16
/**
20
17
* Show full wallet address with AccountAddress
@@ -32,11 +29,7 @@ export function AccountAddressBasic() {
32
29
</ div >
33
30
34
31
< CodeExample
35
- preview = {
36
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
37
- < AccountAddress />
38
- </ AccountProvider >
39
- }
32
+ preview = { < AccountAddressBasicPreview /> }
40
33
code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
41
34
42
35
function App() {
@@ -63,11 +56,7 @@ export function AccountAddressFormat() {
63
56
</ div >
64
57
65
58
< CodeExample
66
- preview = {
67
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
68
- < AccountAddress formatFn = { shortenAddress } />
69
- </ AccountProvider >
70
- }
59
+ preview = { < AccountAddressFormatPreview /> }
71
60
code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
72
61
import { shortenAddress } from "thirdweb/utils";
73
62
@@ -98,11 +87,7 @@ export function AccountNameBasic() {
98
87
</ div >
99
88
100
89
< CodeExample
101
- preview = {
102
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
103
- < AccountName loadingComponent = { < span > Loading...</ span > } />
104
- </ AccountProvider >
105
- }
90
+ preview = { < AccountNameBasicPreview /> }
106
91
code = { `import { AccountProvider, AccountName } from "thirdweb/react";
107
92
108
93
function App() {
@@ -126,14 +111,7 @@ export function AccountNameCustom() {
126
111
</ div >
127
112
128
113
< CodeExample
129
- preview = {
130
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
131
- < AccountName
132
- socialType = "lens"
133
- loadingComponent = { < span > Loading...</ span > }
134
- />
135
- </ AccountProvider >
136
- }
114
+ preview = { < AccountNameCustomPreview /> }
137
115
code = { `import { AccountProvider, AccountName } from "thirdweb/react";
138
116
139
117
function App() {
@@ -164,21 +142,14 @@ export function AccountBalanceBasic() {
164
142
</ div >
165
143
166
144
< CodeExample
167
- preview = {
168
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
169
- < AccountBalance
170
- chain = { ethereum }
171
- loadingComponent = { < span > Loading...</ span > }
172
- />
173
- </ AccountProvider >
174
- }
145
+ preview = { < AccountBalanceBasicPreview /> }
175
146
code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
176
147
import { shortenAddress } from "thirdweb/utils";
177
148
178
149
function App() {
179
150
return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
180
- <AccountBalance
181
- chain={ethereum}
151
+ <AccountBalance
152
+ chain={ethereum}
182
153
loadingComponent={<span>Loading...</span>}
183
154
/>
184
155
</AccountProvider>
@@ -202,25 +173,17 @@ export function AccountBalanceCustomToken() {
202
173
</ div >
203
174
204
175
< CodeExample
205
- preview = {
206
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
207
- < AccountBalance
208
- chain = { ethereum }
209
- tokenAddress = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
210
- loadingComponent = { < span > Loading...</ span > }
211
- />
212
- </ AccountProvider >
213
- }
176
+ preview = { < AccountBalanceCustomTokenPreview /> }
214
177
code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
215
178
import { shortenAddress } from "thirdweb/utils";
216
179
217
180
const USDC_ETHEREUM = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
218
181
219
182
function App() {
220
183
return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
221
- <AccountBalance
222
- chain={ethereum}
223
- tokenAddress={USDC_ETHEREUM}
184
+ <AccountBalance
185
+ chain={ethereum}
186
+ tokenAddress={USDC_ETHEREUM}
224
187
loadingComponent={<span>Loading...</span>}
225
188
/>
226
189
</AccountProvider>
@@ -244,23 +207,13 @@ export function AccountBalanceFormat() {
244
207
</ div >
245
208
246
209
< CodeExample
247
- preview = {
248
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
249
- < AccountBalance
250
- chain = { ethereum }
251
- formatFn = { ( props : AccountBalanceInfo ) =>
252
- `${ Math . ceil ( props . balance * 1000 ) / 1000 } ${ props . symbol } `
253
- }
254
- loadingComponent = { < span > Loading...</ span > }
255
- />
256
- </ AccountProvider >
257
- }
210
+ preview = { < AccountBalanceFormatPreview /> }
258
211
code = { `import { AccountProvider, AccountAddress, type AccountBalanceFormatParams } from "thirdweb/react";
259
212
260
213
function App() {
261
214
return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
262
- <AccountBalance
263
- chain={ethereum}
215
+ <AccountBalance
216
+ chain={ethereum}
264
217
loadingComponent={<span>Loading...</span>}
265
218
formatFn={(props: AccountBalanceInfo) => \`\${Math.ceil(props.balance * 1000) / 1000} \${props.symbol}\`} />
266
219
</AccountProvider>
@@ -284,23 +237,15 @@ export function AccountBalanceUSD() {
284
237
</ div >
285
238
286
239
< CodeExample
287
- preview = {
288
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
289
- < AccountBalance
290
- chain = { ethereum }
291
- showBalanceInFiat = "USD"
292
- loadingComponent = { < span > Loading...</ span > }
293
- />
294
- </ AccountProvider >
295
- }
240
+ preview = { < AccountBalanceUSDPreview /> }
296
241
code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
297
242
298
243
function App() {
299
244
return (
300
245
<AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
301
- <AccountBalance
302
- chain={ethereum}
303
- showBalanceInFiat="USD"
246
+ <AccountBalance
247
+ chain={ethereum}
248
+ showBalanceInFiat="USD"
304
249
loadingComponent={<span>Loading...</span>}
305
250
/>
306
251
</AccountProvider>
@@ -328,14 +273,7 @@ export function AccountAvatarBasic() {
328
273
</ div >
329
274
330
275
< CodeExample
331
- preview = {
332
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
333
- < AccountAvatar
334
- className = "h-20 w-20 rounded-full"
335
- loadingComponent = { < span > Loading...</ span > }
336
- />
337
- </ AccountProvider >
338
- }
276
+ preview = { < AccountAvatarBasicPreview /> }
339
277
code = { `import { AccountProvider, AccountAvatar } from "thirdweb/react";
340
278
341
279
function App() {
@@ -362,11 +300,7 @@ export function AccountBlobbieBasic() {
362
300
</ div >
363
301
364
302
< CodeExample
365
- preview = {
366
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
367
- < AccountBlobbie className = "h-20 w-20 rounded-full" />
368
- </ AccountProvider >
369
- }
303
+ preview = { < AccountBlobbieBasicPreview /> }
370
304
code = { `import { AccountProvider, AccountBlobbie } from "thirdweb/react";
371
305
372
306
function App() {
@@ -394,58 +328,7 @@ export function ConnectDetailsButtonClone() {
394
328
</ div >
395
329
396
330
< CodeExample
397
- preview = {
398
- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
399
- < button
400
- type = "button"
401
- className = "flex min-w-[200px] flex-row items-center gap-2 rounded-md border bg-gray-800 px-4 py-2"
402
- >
403
- < AccountAvatar
404
- className = "h-10 w-10 rounded-full"
405
- loadingComponent = {
406
- < AccountBlobbie className = "h-10 w-10 rounded-full" />
407
- }
408
- fallbackComponent = {
409
- < AccountBlobbie className = "h-10 w-10 rounded-full" />
410
- }
411
- />
412
- < div className = "flex flex-col gap-1" >
413
- < AccountName
414
- className = "text-left"
415
- loadingComponent = {
416
- < AccountAddress
417
- formatFn = { shortenAddress }
418
- className = "text-left"
419
- />
420
- }
421
- fallbackComponent = {
422
- < AccountAddress
423
- formatFn = { shortenAddress }
424
- className = "text-left"
425
- />
426
- }
427
- />
428
- < div className = "flex flex-row items-center gap-2" >
429
- < AccountBalance
430
- className = "text-left text-sm"
431
- chain = { ethereum }
432
- loadingComponent = {
433
- < span className = "text-left text-sm" > Loading...</ span >
434
- }
435
- fallbackComponent = {
436
- < span className = "text-left text-sm" > Loading...</ span >
437
- }
438
- />
439
- < AccountBalance
440
- className = "text-left text-sm"
441
- chain = { ethereum }
442
- showBalanceInFiat = "USD"
443
- />
444
- </ div >
445
- </ div >
446
- </ button >
447
- </ AccountProvider >
448
- }
331
+ preview = { < ConnectDetailsButtonClonePreview /> }
449
332
code = { `import { AccountProvider, AccountAvatar, AccountName, AccountBalance, AccountAddress, AccountBlobbie } from "thirdweb/react";
450
333
451
334
function App() {
@@ -499,7 +382,7 @@ function App() {
499
382
</div>
500
383
</div>
501
384
</button>
502
- </AccountProvider>
385
+ </AccountProvider>
503
386
)
504
387
}` }
505
388
lang = "tsx"
0 commit comments