Skip to content

Commit ac65828

Browse files
committed
fix: remove overlay in drop item
1 parent 0eb8347 commit ac65828

1 file changed

Lines changed: 34 additions & 22 deletions

File tree

front-end/src/components/Header.tsx

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2-
import { Button, notification, Dropdown, Menu } from 'antd';
2+
import { Button, notification, Dropdown } from 'antd';
33
import { WalletOutlined, DisconnectOutlined, CopyOutlined, HomeOutlined } from '@ant-design/icons';
44
import styled from 'styled-components';
55
import { useWeb3, disconnectWallet as disconnectFromContext } from '../context/Web3Context';
@@ -263,26 +263,38 @@ const Header: React.FC = () => {
263263
window.location.href = '#';
264264
};
265265

266-
const walletMenu = (
267-
<Menu>
268-
{selectedWalletName && (
269-
<>
270-
<Menu.Item key="wallet" disabled style={{ cursor: 'default' }}>
271-
<span style={{ color: '#667eea', fontWeight: 600 }}>
272-
{selectedWalletName}
273-
</span>
274-
</Menu.Item>
275-
<Menu.Divider />
276-
</>
277-
)}
278-
<Menu.Item key="copy" onClick={copyAddress} icon={<CopyOutlined />}>
279-
Copy Address
280-
</Menu.Item>
281-
<Menu.Item key="disconnect" onClick={handleDisconnect} icon={<DisconnectOutlined />}>
282-
Disconnect
283-
</Menu.Item>
284-
</Menu>
285-
);
266+
const getMenuItems = () => {
267+
const items: any[] = [];
268+
269+
if (selectedWalletName) {
270+
items.push({
271+
key: 'wallet',
272+
disabled: true,
273+
label: (
274+
<span style={{ color: '#667eea', fontWeight: 600 }}>
275+
{selectedWalletName}
276+
</span>
277+
),
278+
});
279+
items.push({ type: 'divider' });
280+
}
281+
282+
items.push({
283+
key: 'copy',
284+
icon: <CopyOutlined />,
285+
label: 'Copy Address',
286+
onClick: copyAddress,
287+
});
288+
289+
items.push({
290+
key: 'disconnect',
291+
icon: <DisconnectOutlined />,
292+
label: 'Disconnect',
293+
onClick: handleDisconnect,
294+
});
295+
296+
return items;
297+
};
286298

287299
return (
288300
<>
@@ -310,7 +322,7 @@ const Header: React.FC = () => {
310322
Connect Wallet
311323
</Button>
312324
) : (
313-
<Dropdown overlay={walletMenu} trigger={['click']}>
325+
<Dropdown menu={{ items: getMenuItems() }} trigger={['click']}>
314326
<AccountDisplay>
315327
{networkName && (
316328
<NetworkBadge color={networkColor}>

0 commit comments

Comments
 (0)