Skip to content

Commit

Permalink
feat: Add menu button to mobile header
Browse files Browse the repository at this point in the history
  • Loading branch information
timglaser committed Jun 17, 2020
1 parent f232e0a commit d24518e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/components/HamburgerMenu.module.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
button.hamburgerMenu {
display: block;
background: none;
border: 0;
cursor: pointer;
width: 4rem;
outline: none;

div {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

.hideOnDesktop {
@media (min-width: 760px) {
@media (min-width: 760px + 1) {
display: none;
}
}
Expand Down
26 changes: 19 additions & 7 deletions src/components/MobileHeader.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'gatsby';
import cx from 'classnames';
import Navigation from './Navigation';
import HamburgerMenu from './HamburgerMenu';
import styles from './MobileHeader.module.scss';

const MobileHeader = ({ className }) => (
<aside className={cx(styles.container, className)}>
<Link to="/" className={styles.logo} />
{/* <Navigation /> */}
</aside>
);
const MobileHeader = ({ className }) => {
const [isOpen, setIsOpen] = useState(false);

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

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

{/* <Navigation /> */}
</aside>
);
};

MobileHeader.propTypes = {
className: PropTypes.string,
Expand Down

0 comments on commit d24518e

Please sign in to comment.