Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add burgerIcon prop
Browse files Browse the repository at this point in the history
  • Loading branch information
mustofa-id committed Jul 14, 2019
1 parent d5590cf commit 3a413b4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/assets/icons/feather.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 18 additions & 6 deletions src/components/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@ import { Helmet } from 'react-helmet'
import { Link } from 'gatsby'
import Icon from './widget/icon'

const BurgerButton = ({ onClick, isActive }) => (
const BurgerButton = ({ onClick, isActive, burgerIcon }) => (
<div
onClick={onClick}
role='button'
className={`navbar-burger burger${isActive ? ' is-active' : ''}`}
aria-label='menu'
aria-expanded='false'
data-target='griddy-nav-menu'>
<span aria-hidden='true' />
<span aria-hidden='true' />
<span aria-hidden='true' />
{burgerIcon ? (
<div className='column is-vcentered'>
<Icon
name={burgerIcon}
size='24'
color='#0a0a0a'
strokeWidth='1' />
</div>
) : (
<>
<span aria-hidden='true' />
<span aria-hidden='true' />
<span aria-hidden='true' />
</>
)}
</div>
)

const Navbar = ({ backTo = '/', title, subtitle, children }) => {
const Navbar = ({ backTo = '/', title, subtitle, children, burgerIcon }) => {
const [menuShown, setMenuShown] = useState(false)

function toggleMenu () {
Expand Down Expand Up @@ -47,7 +59,7 @@ const Navbar = ({ backTo = '/', title, subtitle, children }) => {
</div>
{/* Burger button */}
{children ? (
<BurgerButton onClick={toggleMenu} isActive={menuShown} />
<BurgerButton onClick={toggleMenu} isActive={menuShown} burgerIcon={burgerIcon} />
) : null}
</div>
<div
Expand Down

0 comments on commit 3a413b4

Please sign in to comment.