Skip to content

Commit

Permalink
feat: Show nav on menu click
Browse files Browse the repository at this point in the history
  • Loading branch information
timglaser committed Jun 17, 2020
1 parent d24518e commit 6e51a4e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
16 changes: 9 additions & 7 deletions src/components/MobileHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ const MobileHeader = ({ className }) => {

return (
<aside className={cx(styles.container, className)}>
<Link to="/" className={styles.logo} />
<div className={styles.menuBar}>
<Link to="/" className={styles.logo} />

<HamburgerMenu
className={styles.hamburgerMenu}
toggle={() => setIsOpen(!isOpen)}
isOpen={isOpen}
/>
<HamburgerMenu
className={styles.hamburgerMenu}
toggle={() => setIsOpen(!isOpen)}
isOpen={isOpen}
/>
</div>

{/* <Navigation /> */}
{isOpen && <Navigation className={styles.navigation} />}
</aside>
);
};
Expand Down
15 changes: 14 additions & 1 deletion src/components/MobileHeader.module.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.container {
position: relative;
border-bottom: 1px solid var(--color-neutrals-100);
}

.menuBar {
display: flex;
align-items: center;
justify-content: space-between;
height: 60px;
padding: 0 1rem;
border-bottom: 1px solid var(--color-neutrals-100);
}

.logo {
Expand All @@ -15,3 +19,12 @@
display: inline-block;
background-image: url('../images/developers-logo.svg');
}

.navigation {
font-size: 1rem;
padding: 1.5rem 3rem;
position: absolute;
width: 100vw;
height: calc(100vh - 90px); // todo grab height values from vars
background-color: var(--color-white);
}
10 changes: 6 additions & 4 deletions src/components/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import { Link } from 'gatsby';
import cx from 'classnames';
import { BreadcrumbContext } from './BreadcrumbContext';
import pages from '../data/sidenav.json';
import { link } from '../types';

import styles from './Navigation.module.scss';

const Navigation = () => {
const Navigation = ({ className }) => {
return (
<nav className={styles.container} role="navigation" aria-label="Navigation">
<nav
className={cx(styles.container, className)}
role="navigation"
aria-label="Navigation"
>
<ul className={styles.listNav}>{renderNav(pages)}</ul>
</nav>
);
};

Navigation.propTypes = {
className: PropTypes.string,
pages: PropTypes.arrayOf(link).isRequired,
};

export default Navigation;
Expand Down

0 comments on commit 6e51a4e

Please sign in to comment.