-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.js
59 lines (58 loc) · 1.49 KB
/
header.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// creating items for the navigation bar
function ItemMenu(props){
return(
<li><a href={props.url}>{props.name}</a></li>
)
}
// creating the navigation bar
function Navbar(){
return(
<ul className="menuSection">
<ItemMenu name="Home" url="index.html"/>
<ItemMenu name="Portfolio" url="pages/portfolio/portfolio.html"/>
<ItemMenu name="Gaming" url="pages/gaming/gaming.html"/>
<ItemMenu name="Music" url="pages/music/music.html"/>
<ItemMenu name="Books" url="pages/books/books.html"/>
<ItemMenu name="Gymnastics" url="pages/gymnastics/gymnastics.html"/>
</ul>
)
}
// creating the logo section
function LogoSection(){
return (
<div className="logoSection">
<a href="index.html"><img class="logoUrl"></img></a>
</div>
)
}
// creating the burger menu section
function BurgerComponent(){
return (
<div className="burgerMenu">
<span className="bar1"></span>
<span className="bar2"></span>
<span className="bar3"></span>
</div>
)
}
// creatin the headerSction
function HeaderSection(){
return(
<>
<LogoSection />
<Navbar />
<BurgerComponent />
</>
)
}
ReactDOM.render(
<HeaderSection />,
document.querySelector("header")
)
// burger menu section for onclickevent
const burger = document.querySelector(".burgerMenu");
const menu = document.querySelector(".menuSection");
burger.addEventListener("click", ()=>{
burger.classList.toggle("change");
menu.classList.toggle("active");
})