Skip to content

Commit 276dd6c

Browse files
Merge pull request #1368 from playmint/metamask-banner-more-fixes
MetaMask switch network banner (MORE FIXES)
2 parents dcceee7 + 7579790 commit 276dd6c

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

frontend/src/components/panels/network-panel.tsx

+22-6
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,38 @@ import { TextButton } from '@app/styles/button.styles';
88
import { useWalletProvider } from '@app/hooks/use-wallet-provider';
99

1010
const Banner = styled(StyledHeaderPanel)`
11-
position: relative;
12-
top: 0;
11+
position: fixed;
12+
bottom: 0;
1313
width: 100%;
14-
background-color: #f9f9f9;
14+
background-color: rgba(249, 249, 249, 0.8);
15+
backdrop-filter: blur(10px);
1516
z-index: 9999;
1617
display: flex;
1718
justify-content: center;
1819
align-items: center;
1920
padding: 20px 0;
20-
border-top: 0px;
21+
border-top: 3px solid black;
2122
border-left: 0px;
2223
border-right: 0px;
23-
border-top-left-radius: 0;
24-
border-top-right-radius: 0;
24+
border-bottom: 0px;
25+
border-bottom-left-radius: 0;
26+
border-bottom-right-radius: 0;
2527
`;
2628

2729
const Text = styled.p`
2830
margin: 0;
2931
padding-right: 20px;
3032
`;
3133

34+
const CloseButton = styled.button`
35+
position: absolute;
36+
right: 20px;
37+
background: none;
38+
border: none;
39+
font-size: 20px;
40+
cursor: pointer;
41+
`;
42+
3243
export interface WalletContextValue {
3344
provider?: WalletProvider;
3445
}
@@ -39,6 +50,10 @@ export const NetworkPanel = () => {
3950
const [shouldRender, setShouldRender] = useState<boolean>(true);
4051
const { provider } = useWalletProvider();
4152

53+
const closeBanner = () => {
54+
setShouldRender(false);
55+
};
56+
4257
const checkNetwork = useCallback(async () => {
4358
if (provider?.method.toLowerCase() !== 'metamask') {
4459
setShouldRender(false);
@@ -169,6 +184,7 @@ export const NetworkPanel = () => {
169184
You need to switch to the <b>{config?.networkName}</b> network in MetaMask
170185
</Text>
171186
<TextButton onClick={switchNetwork}>Switch Network</TextButton>
187+
<CloseButton onClick={closeBanner}>x</CloseButton>
172188
</Banner>
173189
);
174190
};

0 commit comments

Comments
 (0)