File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
examples/vite-react/src/components Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1- import { Box , Text , Stack , IconButton } from '@interchain-ui/react' ;
1+ import { Box , Text , IconButton } from '@interchain-ui/react' ;
22import { DENOM_DISPLAY } from '../utils/constants' ;
3+ import { useState } from 'react' ;
34
45interface WalletDetailsProps {
56 address : string ;
@@ -8,20 +9,29 @@ interface WalletDetailsProps {
89}
910
1011const WalletDetails = ( { address, balance, onRefresh } : WalletDetailsProps ) => {
12+ const [ refreshing , setRefreshing ] = useState ( false ) ;
1113 return (
1214 < Box >
1315 < Text > Address: { address } </ Text >
14- < Stack >
16+ < div style = { { display : 'flex' , alignItems : 'center' } } >
1517 < Text >
1618 Balance: { balance ?? '0' } { DENOM_DISPLAY }
1719 </ Text >
1820 < IconButton
1921 aria-label = "Refresh balance"
2022 size = "sm"
21- onClick = { onRefresh }
22- icon = 'copy'
23+ onClick = { ( ) => {
24+ if ( refreshing ) return ;
25+ setRefreshing ( true ) ;
26+ setTimeout ( ( ) => {
27+ setRefreshing ( false ) ;
28+ } , 10000 ) ;
29+ onRefresh ( )
30+ } }
31+ icon = 'restart'
32+ attributes = { { marginLeft : '$4' } }
2333 />
24- </ Stack >
34+ </ div >
2535 </ Box >
2636 ) ;
2737} ;
You can’t perform that action at this time.
0 commit comments