Skip to content

Commit 2c6fd2a

Browse files
authored
Merge pull request #91 from kleros/chore/ui-impros
fix: mobile navbar improvements
2 parents 1363343 + b11cd77 commit 2c6fd2a

File tree

2 files changed

+47
-27
lines changed

2 files changed

+47
-27
lines changed

web/src/layout/Header/MobileHeader.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@ const Container = styled.div`
2727
`;
2828

2929
const StyledLightButton = styled(LightButton)`
30-
padding: 0;
30+
padding: 0 !important;
3131
3232
.button-svg {
3333
margin-right: 0px;
34-
fill: white;
35-
}
36-
.button-text {
37-
display: none;
3834
}
3935
`;
4036

web/src/layout/Header/navbar/index.tsx

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import styled from "styled-components";
44
import { useToggle } from "react-use";
55
import { useAccount } from "wagmi";
66

7-
import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";
8-
97
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
108

9+
import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";
10+
1111
import ConnectWallet from "components/ConnectWallet";
1212
import LightButton from "components/LightButton";
1313
import OverlayPortal from "components/OverlayPortal";
@@ -21,16 +21,29 @@ import Help from "./Menu/Help";
2121
import Settings from "./Menu/Settings";
2222
import { DisconnectWalletButton } from "./Menu/Settings/General";
2323

24+
const Wrapper = styled.div<{ isOpen: boolean }>`
25+
visibility: ${({ isOpen }) => (isOpen ? "visible" : "hidden")};
26+
position: absolute;
27+
top: 100%;
28+
left: 0;
29+
width: 100vw;
30+
height: 100vh;
31+
z-index: 1;
32+
`;
33+
34+
const StyledOverlay = styled(Overlay)`
35+
top: unset;
36+
`;
37+
2438
const Container = styled.div<{ isOpen: boolean }>`
2539
position: absolute;
26-
top: 64px;
40+
top: 0;
2741
left: 0;
2842
right: 0;
29-
max-height: calc(100vh - 64px);
43+
max-height: calc(100vh - 160px);
3044
overflow-y: auto;
3145
z-index: 1;
3246
background-color: ${({ theme }) => theme.whiteBackground};
33-
border: 1px solid ${({ theme }) => theme.stroke};
3447
box-shadow: 0px 2px 3px ${({ theme }) => theme.defaultShadow};
3548
transform-origin: top;
3649
transform: scaleY(${({ isOpen }) => (isOpen ? "1" : "0")});
@@ -80,23 +93,34 @@ const NavBar: React.FC = () => {
8093

8194
return (
8295
<>
83-
<Container {...{ isOpen }}>
84-
<LightButton text="Kleros Solutions" onClick={toggleIsDappListOpen} Icon={KlerosSolutionsIcon} />
85-
<hr />
86-
<Explore isMobileNavbar={true} />
87-
<hr />
88-
<WalletContainer>
89-
<ConnectWallet />
90-
{isConnected && (
91-
<DisconnectWalletButtonContainer>
92-
<DisconnectWalletButton />
93-
</DisconnectWalletButtonContainer>
94-
)}
95-
</WalletContainer>
96-
<hr />
97-
<Menu {...{ toggleIsHelpOpen, toggleIsSettingsOpen }} />
98-
<br />
99-
</Container>
96+
<Wrapper {...{ isOpen }}>
97+
<StyledOverlay>
98+
<Container {...{ isOpen }}>
99+
<LightButton
100+
isMobileNavbar={true}
101+
text="Kleros Solutions"
102+
onClick={() => {
103+
toggleIsDappListOpen();
104+
}}
105+
Icon={KlerosSolutionsIcon}
106+
/>
107+
<hr />
108+
<Explore isMobileNavbar={true} />
109+
<hr />
110+
<WalletContainer>
111+
<ConnectWallet />
112+
{isConnected && (
113+
<DisconnectWalletButtonContainer>
114+
<DisconnectWalletButton />
115+
</DisconnectWalletButtonContainer>
116+
)}
117+
</WalletContainer>
118+
<hr />
119+
<Menu {...{ toggleIsHelpOpen, toggleIsSettingsOpen }} isMobileNavbar={true} />
120+
<br />
121+
</Container>
122+
</StyledOverlay>
123+
</Wrapper>
100124
{(isDappListOpen || isHelpOpen || isSettingsOpen) && (
101125
<OverlayPortal>
102126
<Overlay>

0 commit comments

Comments
 (0)