Skip to content

Commit

Permalink
add snap icon at WalletList
Browse files Browse the repository at this point in the history
  • Loading branch information
gin-lsl committed Apr 30, 2024
1 parent e887945 commit 3fcfa9a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/web3/src/connect-modal/components/WalletList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { forwardRef, useContext, useImperativeHandle, useMemo } from 'react';
import { QrcodeOutlined } from '@ant-design/icons';
import { MetaMaskColorful } from '@ant-design/web3-icons';
import { Button, List, Space, Typography } from 'antd';
import classNames from 'classnames';

Expand Down Expand Up @@ -91,7 +92,12 @@ const WalletList = forwardRef<ConnectModalActionType, WalletListProps>((props, r
{typeof item.icon === 'string' || item.icon === undefined ? (
<img className={`${prefixCls}-img`} src={item.icon} alt={item.name} />
) : (
<div className={`${prefixCls}-icon`}>{item.icon}</div>
<div className={`${prefixCls}-icon`}>
{item.icon}
{(item as any).isMetaMaskSnap && (
<MetaMaskColorful className={`${prefixCls}-icon-metamask-snap`} />
)}
</div>
)}
<Typography.Text ellipsis={{ tooltip: true }} className={`${prefixCls}-name`}>
{item.name}
Expand Down
7 changes: 7 additions & 0 deletions packages/web3/src/connect-modal/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,20 @@ const getThemeStyle = (token: ConnectModalToken): CSSInterpolation => {
width: '100%',
overflow: 'hidden',
[`${componentCls}-icon`]: {
position: 'relative',
borderRadius: 8,
overflow: 'hidden',
width: token.iconSize,
height: token.iconSize,
fontSize: token.iconSize,
lineHeight: `${token.iconSize}px`,
flexShrink: 0,
[`${componentCls}-icon-metamask-snap`]: {
position: 'absolute',
right: 2,
bottom: 2,
fontSize: 12,
},
},
[`${componentCls}-img`]: {
borderRadius: 8,
Expand Down
4 changes: 2 additions & 2 deletions packages/web3/src/solana/demos/more-wallets.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ConnectButton, Connector } from '@ant-design/web3';
import {
CoinbaseWallet,
MetamaskSnapWallet,
PhantomWallet,
SolanaWeb3ConfigProvider,
SolflareMetaMaskSnapWallet,
} from '@ant-design/web3-solana';

const App: React.FC = () => {
return (
<SolanaWeb3ConfigProvider
autoConnect
wallets={[CoinbaseWallet(), PhantomWallet(), MetamaskSnapWallet()]}
wallets={[CoinbaseWallet(), PhantomWallet(), SolflareMetaMaskSnapWallet()]}
>
<Connector>
<ConnectButton />
Expand Down

0 comments on commit 3fcfa9a

Please sign in to comment.