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" ;
151import { 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" ;
1815
1916/**
2017 * Show full wallet address with AccountAddress
@@ -32,11 +29,7 @@ export function AccountAddressBasic() {
3229 </ div >
3330
3431 < CodeExample
35- preview = {
36- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
37- < AccountAddress />
38- </ AccountProvider >
39- }
32+ preview = { < AccountAddressBasicPreview /> }
4033 code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
4134
4235function App() {
@@ -63,11 +56,7 @@ export function AccountAddressFormat() {
6356 </ div >
6457
6558 < CodeExample
66- preview = {
67- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
68- < AccountAddress formatFn = { shortenAddress } />
69- </ AccountProvider >
70- }
59+ preview = { < AccountAddressFormatPreview /> }
7160 code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
7261import { shortenAddress } from "thirdweb/utils";
7362
@@ -98,11 +87,7 @@ export function AccountNameBasic() {
9887 </ div >
9988
10089 < CodeExample
101- preview = {
102- < AccountProvider address = { vitalikAddress } client = { THIRDWEB_CLIENT } >
103- < AccountName loadingComponent = { < span > Loading...</ span > } />
104- </ AccountProvider >
105- }
90+ preview = { < AccountNameBasicPreview /> }
10691 code = { `import { AccountProvider, AccountName } from "thirdweb/react";
10792
10893function App() {
@@ -126,14 +111,7 @@ export function AccountNameCustom() {
126111 </ div >
127112
128113 < 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 /> }
137115 code = { `import { AccountProvider, AccountName } from "thirdweb/react";
138116
139117function App() {
@@ -164,21 +142,14 @@ export function AccountBalanceBasic() {
164142 </ div >
165143
166144 < 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 /> }
175146 code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
176147import { shortenAddress } from "thirdweb/utils";
177148
178149function App() {
179150 return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
180- <AccountBalance
181- chain={ethereum}
151+ <AccountBalance
152+ chain={ethereum}
182153 loadingComponent={<span>Loading...</span>}
183154 />
184155 </AccountProvider>
@@ -202,25 +173,17 @@ export function AccountBalanceCustomToken() {
202173 </ div >
203174
204175 < 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 /> }
214177 code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
215178import { shortenAddress } from "thirdweb/utils";
216179
217180const USDC_ETHEREUM = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
218181
219182function App() {
220183 return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
221- <AccountBalance
222- chain={ethereum}
223- tokenAddress={USDC_ETHEREUM}
184+ <AccountBalance
185+ chain={ethereum}
186+ tokenAddress={USDC_ETHEREUM}
224187 loadingComponent={<span>Loading...</span>}
225188 />
226189 </AccountProvider>
@@ -244,23 +207,13 @@ export function AccountBalanceFormat() {
244207 </ div >
245208
246209 < 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 /> }
258211 code = { `import { AccountProvider, AccountAddress, type AccountBalanceFormatParams } from "thirdweb/react";
259212
260213function App() {
261214 return <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
262- <AccountBalance
263- chain={ethereum}
215+ <AccountBalance
216+ chain={ethereum}
264217 loadingComponent={<span>Loading...</span>}
265218 formatFn={(props: AccountBalanceInfo) => \`\${Math.ceil(props.balance * 1000) / 1000} \${props.symbol}\`} />
266219 </AccountProvider>
@@ -284,23 +237,15 @@ export function AccountBalanceUSD() {
284237 </ div >
285238
286239 < 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 /> }
296241 code = { `import { AccountProvider, AccountAddress } from "thirdweb/react";
297242
298243function App() {
299244 return (
300245 <AccountProvider address="0xd8da6bf26964af9d7eed9e03e53415d37aa96045" client={thirdwebClient}>
301- <AccountBalance
302- chain={ethereum}
303- showBalanceInFiat="USD"
246+ <AccountBalance
247+ chain={ethereum}
248+ showBalanceInFiat="USD"
304249 loadingComponent={<span>Loading...</span>}
305250 />
306251 </AccountProvider>
@@ -328,14 +273,7 @@ export function AccountAvatarBasic() {
328273 </ div >
329274
330275 < 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 /> }
339277 code = { `import { AccountProvider, AccountAvatar } from "thirdweb/react";
340278
341279function App() {
@@ -362,11 +300,7 @@ export function AccountBlobbieBasic() {
362300 </ div >
363301
364302 < 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 /> }
370304 code = { `import { AccountProvider, AccountBlobbie } from "thirdweb/react";
371305
372306function App() {
@@ -394,58 +328,7 @@ export function ConnectDetailsButtonClone() {
394328 </ div >
395329
396330 < 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 /> }
449332 code = { `import { AccountProvider, AccountAvatar, AccountName, AccountBalance, AccountAddress, AccountBlobbie } from "thirdweb/react";
450333
451334function App() {
@@ -499,7 +382,7 @@ function App() {
499382 </div>
500383 </div>
501384 </button>
502- </AccountProvider>
385+ </AccountProvider>
503386 )
504387}` }
505388 lang = "tsx"
0 commit comments