-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathHeader.js
More file actions
93 lines (87 loc) · 3.12 KB
/
Header.js
File metadata and controls
93 lines (87 loc) · 3.12 KB
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
import { useState } from "react";
import Link from "next/link";
import Image from "next/image";
import { useRouter } from "next/router";
import { AiOutlineMenu, AiOutlineClose } from "react-icons/ai";
const MobileHeader = ({ links, setMobileActive, redirectToRegistration }) => {
return (
<>
<div className="fixed top-0 w-full h-screen block justify-center items-center bg-[#051630] z-50 overscroll-none font-primary text-white transition-all duration-200 ease-in-out">
<div className="pt-5 px-4 flex justify-end items-center">
<button
onClick={() => setMobileActive(false)}
className="inline-flex justify-center items-center"
>
<AiOutlineClose size={35} />
</button>
</div>
<nav className="mt-16 w-full h-full flex flex-col justify-start items-center">
{links.map((link, index) => (
<Link key={index} href={`${link.href}`} scroll={false}>
<a
onClick={() => setMobileActive(false)}
className="uppercase mb-14 text-3xl tracking-widest"
>
{link.name}
</a>
</Link>
))}
</nav>
</div>
</>
);
};
const Header = ({ links, metainfo, secondary = false }) => {
const [mobileActive, setMobileActive] = useState(false);
const router = useRouter();
const redirectToRegistration = () => {
router.push("/hackrplay/2022/registration");
};
return (
<>
{secondary ? (
<header className="pt-4 pb-2 md:px-10 px-5 inline-flex justify-between items-center bg-transparent font-primary text-white z-10 w-full">
<div className="md:w-40 w-36 z-10">
<Link href={`/`}>
<a>
<Image
src={require(`/public/${metainfo.name}/NavbarLogo.png`)}
alt="Navbar Logo"
layout="responsive"
/>
</a>
</Link>
</div>
</header>
) : (
<header className="pt-6 pb-1 px-4 flex md:justify-center justify-end items-baseline bg-transparent font-primary text-white z-10">
<div className="md:inline-flex hidden justify-center items-baseline mx-auto z-10">
{links &&
links.map((link, index) => (
<Link key={index} href={`${link.href}`} scroll={false}>
<a className="uppercase mr-16 last:mr-0 text-lg tracking-widest">
{link.name}
</a>
</Link>
))}
</div>
<button
onClick={() => setMobileActive(true)}
className="md:hidden inline-flex justify-center items-center z-10 py-2 px-4 border border-gray-400 text-[#00F2FE]"
>
<AiOutlineMenu size={20} />
</button>
</header>
)}
{!secondary && mobileActive && (
<MobileHeader
secondary={secondary}
links={links}
setMobileActive={setMobileActive}
redirectToRegistration={redirectToRegistration}
/>
)}
</>
);
};
export default Header;