Skip to content

Commit

Permalink
Merge pull request #3 from lidofinance/feature/ethui-201-added-toast-…
Browse files Browse the repository at this point in the history
…after-add-to-wallet

feat: added toast after add to wallet
  • Loading branch information
DiRaiks authored Aug 9, 2023
2 parents ce7c837 + 16b56d5 commit 1baa325
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions shared/components/token-to-wallet/token-to-wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tooltip } from '@lidofinance/lido-ui';
import { ToastInfo, Tooltip } from '@lidofinance/lido-ui';
import { useTokenToWallet } from '@lido-sdk/react';
import { TokenToWalletStyle } from './styles';

Expand All @@ -12,9 +12,16 @@ export const TokenToWallet: TokenToWalletComponent = (props) => {

if (!addToken) return null;

const onClickHandler = async () => {
const result = await addToken();
if (!result) return;

ToastInfo('Tokens were successfully added to your wallet', {});
};

return (
<Tooltip placement="bottomLeft" title="Add tokens to wallet">
<TokenToWalletStyle tabIndex={-1} onClick={addToken} {...rest} />
<TokenToWalletStyle tabIndex={-1} onClick={onClickHandler} {...rest} />
</Tooltip>
);
};

0 comments on commit 1baa325

Please sign in to comment.