Skip to content

Commit 206ee0a

Browse files
committed
improve of balance renew button
1 parent 79727e2 commit 206ee0a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

examples/vite-react/src/components/WalletDetails.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Box, Text, Stack, IconButton } from '@interchain-ui/react';
1+
import { Box, Text, IconButton } from '@interchain-ui/react';
22
import { DENOM_DISPLAY } from '../utils/constants';
3+
import { useState } from 'react';
34

45
interface WalletDetailsProps {
56
address: string;
@@ -8,20 +9,29 @@ interface WalletDetailsProps {
89
}
910

1011
const 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
};

0 commit comments

Comments
 (0)