Skip to content

Commit

Permalink
Merge pull request #23 from Pma913/feature/hamburg
Browse files Browse the repository at this point in the history
Feature/hamburg
  • Loading branch information
Pma913 authored Dec 31, 2023
2 parents b6e3118 + b7fb85e commit 158d266
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 25 deletions.
Empty file.
33 changes: 33 additions & 0 deletions src/components/Hamburg/Hamburg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useState } from 'react';
import { NavLink } from 'react-router-dom';
import './Hamburg.css';
import ham from '../../utilities/hamburg.svg';
import x from '../../utilities/x.svg';


const Hamburg = () => {
const [hamburger, setHamburger] = useState(false);
const [hidden, setHidden] = useState('hidden');

const toggleHamburg = () => {
setHamburger(!hamburger);
toggleHidden();
}

const toggleHidden = () => {
hidden === 'hidden' ? setHidden('') : setHidden('hidden');
}

return (
<div className="ham-menu-box">
<img className="hamburg" alt="" src={!hamburger ? ham : x} onClick={toggleHamburg}/>
<div className={`home-menu ${hidden}`}>
<NavLink className="link" to="/">home</NavLink>
<NavLink className="link" to="/fact">facts</NavLink>
<NavLink className="link" to="/favorites">favorites</NavLink>
</div>
</div>
)
}

export default Hamburg;
35 changes: 25 additions & 10 deletions src/components/Header/Header.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
.header {
display: flex;
justify-content: space-between;
justify-content: space-evenly;
background-color: rgb(7, 241, 218);
}

.logo {
height: 150px;
height: 135px;
cursor: pointer;
margin: 10px;
}

.app-title {
font-size: xxx-large;
}

.link {
.link,
.logo-link {
all: unset;
cursor: pointer;
}

.link {
margin: 5px;
font-size: large;
font-weight: 500;
cursor: pointer;
}

.link:hover {
Expand All @@ -27,11 +32,6 @@
border-radius: 2px;
}

.hamburg {
width: 2em;
cursor: pointer;
}

.hidden {
display: none;
}
Expand All @@ -41,7 +41,13 @@
align-items: center;
}

@media (max-width: 584px){
@media (min-width: 584px) {
.ham-menu-box {
display: none;
}
}

@media (max-width: 584px) {
.app-title {
text-align: center;
}
Expand All @@ -50,5 +56,14 @@
flex-direction: column;
align-items: center;
}

.hamburg {
width: 2em;
cursor: pointer;
}

.nav-links {
display: none;
}
}

18 changes: 3 additions & 15 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
import React, { useState } from 'react';
import { NavLink, Link } from 'react-router-dom';
import './Header.css';
import ham from '../../utilities/hamburg.svg'
import Hamburg from '../Hamburg/Hamburg';

const Header = () => {
const [dropDown, setDropdown] = useState("hidden")
// const [hamb, setHamb] = useState("")

const toggleDrop = () => {
if (dropDown === "hidden") {
setDropdown("")
// setHamb("hidden")
} else {
setDropdown("hidden")
// setHamb("")
}
}

return (
<section className="header">
<Link to="/"><img className="logo" src="./cats_meow.png" alt="Cute cat"/></Link>
<h1 className="app-title">Cats Meow</h1>
<img className={`hamburg hidden`} src={ham} alt="ham menu" onClick={toggleDrop}/>
<Link to="/" className="logo-link"><h1 className="app-title">Cats Meow</h1></Link>
<div className={`nav-links`}>
<NavLink className="link" to="/">home</NavLink>
<NavLink className="link" to="/fact">facts</NavLink>
<NavLink className="link" to="/favorites">favorites</NavLink>
</div>
<Hamburg />
</section>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/utilities/x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 158d266

@vercel
Copy link

@vercel vercel bot commented on 158d266 Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cats-meow – ./

cats-meow.vercel.app
cats-meow-git-main-pma913.vercel.app
cats-meow-pma913.vercel.app

Please sign in to comment.