Skip to content

Commit

Permalink
WIP hamburger / sidebar menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Eloise Barrow authored and Eloise Barrow committed Aug 29, 2019
1 parent 7f4fcaa commit e804fa6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 17 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "recycle-nyc",
"homepage": "https://eloisebarrow.github.com/recycle-nyc",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand All @@ -16,8 +15,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy" : "npm run build&&gh-pages -d build"
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
43 changes: 36 additions & 7 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,16 @@ html, body, #root {
padding: 2%;
}

/*.link-styles, .headline, .ul-styles,*/ .headline, .recycle-logo {
.headline {
display: none;
margin: 0;
padding: 0;
}

.hamburger {
display: none;
display: flex;
flex-direction: column;
justify-content: space-around;
width: 70px;
height: 70px;
border: 1px solid white;
Expand All @@ -182,16 +184,43 @@ html, body, #root {
}

.hamburger-slice {
border-bottom: 5px solid white;
border-bottom: 3px solid #FFFFFF;
width: 90%;
margin-bottom: 3px;
align-self: center;
border-radius: 50%;
}

.ul-styles {
display: flex;
.hamburger-slice:last-child {
margin-bottom: 0;
}

.sidebar {
display: none;
flex-direction: column;
height: 100px;
/* height: 100px; */
margin: 0;
padding: 0;
transform: translate(100,0);
transform: translateX(120%);
transition: all .2s ease-in-out 0s;
}

.sidebar-active {
transform: translateX(0%);
transition: all .2s ease-in-out 0s;
display: flex;
}

.hideburger {
display: none;
}

li {
margin-bottom: 13px;
}

li:last-child {
margin-bottom: 0;
}

.link-styles {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import '../App.css';

const Footer = () => {
const handleClick = () => {
window.scrollTo(0,0);
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
}

return (
Expand Down
19 changes: 13 additions & 6 deletions src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import React from 'react'
import React, { useState } from 'react'
import '../App.css'
import { Link } from 'react-router-dom'

const Header = () => {
const [sidebarVisible, setSidebarVisible] = useState(false)

return (

<header className='header-styles'>

<h1 id="title">Recycle NYC</h1>
<div className='hamburger'>
<i class="fas fa-bars"></i>

<h1 id="title">Recycle NYC</h1>
<div
className={`${!sidebarVisible ? 'hamburger' : 'hideburger'}`}
onClick={() => setSidebarVisible(true)}
>
<div className="hamburger-slice"></div>
<div className="hamburger-slice"></div>
<div className="hamburger-slice"></div>
</div>
<ul className='ul-styles'>
<ul className={`ul-styles sidebar ${sidebarVisible ? 'sidebar-active' : ''}`}>
<li><Link className='link-styles' to="/">home</Link></li>
<li><Link className='link-styles' to="/about">about</Link></li>
<li><Link className='link-styles' to="/resources">resources</Link></li>
Expand Down

0 comments on commit e804fa6

Please sign in to comment.