-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.js
110 lines (101 loc) · 3.73 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { useState } from "preact/hooks";
//'https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css
const menuItems = [
{
id: 1,
title: 'Home',
exact: true,
to: '/',
icon: 'bx bx-home-alt',
},
{
id: 2,
title: 'Portfolio',
exact: true,
to: '/portfolio',
icon: 'bx bx-briefcase',
},
{
id: 3,
title: 'Concepts',
exact: true,
to: '/concepts',
icon: 'bx bx-bracket ',
},
{
id: 4,
title: 'Contact',
exact: true,
to: '/contact',
icon: 'bx bx-comment-detail',
},
];
export default function Header(props) {
const [nav, setNav] = useState(false)
const handleClick = () => setNav(!nav)
return <>
<div className={`fixed w-full h-[180px] flex justify-between items-center px-4`}>
<div>
{/* Logo or Tag */}
<h1 className="text-5xl ">YH</h1>
</div>
{/* Desktop */}
{<ul className={`hidden md:flex`}>
{menuItems.map((item) =>
<li key={item.id}>
<a href={item.to}>
<div>
<h2 className="text-lg font-semibold sm:text-xl">
<i className={` ${item.icon} sm:px-1`} ></i>
{item.title}
</h2>
</div>
</a>
</li>)}
</ul>}
{/* Hamburger Menu */}
<div className={`md:hidden z-10 text-6xl`} onClick={handleClick}>
{!nav ? <i class='bx bx-menu' /> : <i class='bx bx-x '></i>}
</div>
{/* Mobile */}
<ul className={!nav ? "hidden" : `absolute top-0 left-0 w-full h-screen flex flex-col justify-center items-center ${props.darkMode === 'night' ? 'bg-slate-900': 'bg-white' }`} >
{menuItems.map((item) =>
<li key={item.id}>
<a href={item.to}>
<div>
<h2 className="font-semibold py-6 text-5xl">
<i className={` ${item.icon} `} ></i>
{item.title}
</h2>
</div>
</a>
</li>)}
</ul>
{/* Social Media */}
<div className="fixed flex-col top-[35%] left-0 sm:flex hidden">
<ul>
<li className="w-[160px] h-[60px] flex justify-between items-center ml-[-100px] hover:ml-[-10px] duration-300 bg-blue-700 text-gray-300">
<a
href="YOUR_LINK_HERE"
target="_blank"
rel="noreferrer"
className="flex justify-around items-center w-full">
LinkedIn <i className="bx bxl-linkedin text-3xl" />
</a>
</li>
</ul>
<ul>
<li className="w-[160px] h-[60px] flex justify-between items-center ml-[-100px] hover:ml-[-10px] duration-300 bg-gray-700 text-gray-300">
<a
href="YOUR_LINK_HERE"
target="_blank"
rel="noreferrer"
className="flex justify-around items-center w-full">
Github <i className="bx bxl-github text-3xl" />
</a>
</li>
</ul>
</div>
</div>
</>
}