Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 0c26990

Browse files
committed
Fix nav issue
Observation: The nav links ul hieght was increased due to addition of new link in it. Due to which the top value of `-600%` couldn't make it hidden in collapsed state. Fix: In order make this dynamic, no matter how many links may be added or removed we should have the top value dynamic. - Observation resulted in conclusion that top should be 100% multiplied by (number of links in nav - 1). So added that as inline style when the nav is in collapsed state. - Removed top value from styles file. As that is redundant and unnecessary now.
1 parent 57e1144 commit 0c26990

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

components/common/header/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class NavBar extends React.Component {
9292
this.props.router.query.subject.slice(1)} | Coderplex`
9393
: metaData.title;
9494
const { description, image } = metaData;
95+
const navCollapseStyle = { top: `-${(this.state.navItems.length - 1) * 100}%` };
9596
return (
9697
<Headroom>
9798
<Header>
@@ -109,7 +110,9 @@ class NavBar extends React.Component {
109110
/>
110111
</Link>
111112
</NavLogo>
112-
<NavLinks className={this.state.menuOpen ? 'open' : ''}>
113+
<NavLinks
114+
className={this.state.menuOpen ? 'open' : ''}
115+
style={this.state.menuOpen ? {} : navCollapseStyle}>
113116
{this.state.navItems
114117
.filter(item => !item.external)
115118
.map(item => (

components/common/header/index.styles.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const NavLinks = styled.ul`
4848
width: 100%;
4949
position: fixed;
5050
z-index: -1;
51-
top: -600%;
5251
left: 0;
5352
background: #fbfbfb;
5453
border-bottom: 1px solid #eee;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy