Skip to content

Commit 3fcfa9a

Browse files
committed
add snap icon at WalletList
1 parent e887945 commit 3fcfa9a

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

packages/web3/src/connect-modal/components/WalletList.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { forwardRef, useContext, useImperativeHandle, useMemo } from 'react';
22
import { QrcodeOutlined } from '@ant-design/icons';
3+
import { MetaMaskColorful } from '@ant-design/web3-icons';
34
import { Button, List, Space, Typography } from 'antd';
45
import classNames from 'classnames';
56

@@ -91,7 +92,12 @@ const WalletList = forwardRef<ConnectModalActionType, WalletListProps>((props, r
9192
{typeof item.icon === 'string' || item.icon === undefined ? (
9293
<img className={`${prefixCls}-img`} src={item.icon} alt={item.name} />
9394
) : (
94-
<div className={`${prefixCls}-icon`}>{item.icon}</div>
95+
<div className={`${prefixCls}-icon`}>
96+
{item.icon}
97+
{(item as any).isMetaMaskSnap && (
98+
<MetaMaskColorful className={`${prefixCls}-icon-metamask-snap`} />
99+
)}
100+
</div>
95101
)}
96102
<Typography.Text ellipsis={{ tooltip: true }} className={`${prefixCls}-name`}>
97103
{item.name}

packages/web3/src/connect-modal/style/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,20 @@ const getThemeStyle = (token: ConnectModalToken): CSSInterpolation => {
129129
width: '100%',
130130
overflow: 'hidden',
131131
[`${componentCls}-icon`]: {
132+
position: 'relative',
132133
borderRadius: 8,
133134
overflow: 'hidden',
134135
width: token.iconSize,
135136
height: token.iconSize,
136137
fontSize: token.iconSize,
137138
lineHeight: `${token.iconSize}px`,
138139
flexShrink: 0,
140+
[`${componentCls}-icon-metamask-snap`]: {
141+
position: 'absolute',
142+
right: 2,
143+
bottom: 2,
144+
fontSize: 12,
145+
},
139146
},
140147
[`${componentCls}-img`]: {
141148
borderRadius: 8,

packages/web3/src/solana/demos/more-wallets.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { ConnectButton, Connector } from '@ant-design/web3';
22
import {
33
CoinbaseWallet,
4-
MetamaskSnapWallet,
54
PhantomWallet,
65
SolanaWeb3ConfigProvider,
6+
SolflareMetaMaskSnapWallet,
77
} from '@ant-design/web3-solana';
88

99
const App: React.FC = () => {
1010
return (
1111
<SolanaWeb3ConfigProvider
1212
autoConnect
13-
wallets={[CoinbaseWallet(), PhantomWallet(), MetamaskSnapWallet()]}
13+
wallets={[CoinbaseWallet(), PhantomWallet(), SolflareMetaMaskSnapWallet()]}
1414
>
1515
<Connector>
1616
<ConnectButton />

0 commit comments

Comments
 (0)