Header.js
2.7 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import React, { useState } from "react";
import styled from "styled-components";
import { Link } from "react-router-dom";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faComments } from "@fortawesome/free-solid-svg-icons";
const Header = styled.header`
display: block;
`;
const Nav = styled.nav`
height: 70px;
width: 100%;
position: fixed;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
background-color: rgba(255, 255, 255);
z-index: 100;
`;
const HeaderBox = styled.div`
height: 100%;
max-width: 80%;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 auto;
`;
const HeaderTitleBox = styled.div`
display: flex;
height: 100%;
align-items: center;
svg {
font-size: 1.5rem;
margin-right: 10px;
}
`;
const HeaderTitle = styled.span`
font-size: 1.5rem;
font-weight: 600;
`;
const HeaderMenuNav = styled.nav`
display: flex;
justify-content: flex-start;
width: 100%;
height: 80%;
`;
const HeaderMenuList = styled.ul`
display: flex;
flex-direction: row;
align-items: center;
flex: 1;
`;
const HeaderMenuItem = styled.li`
font-size: 1.2rem;
width: auto;
padding: 1rem;
`;
const StartBox = styled.div`
display: flex;
align-items: center;
`;
const StartLink = styled(Link)`
background-color: white;
color: black;
border: 2px solid #3dc1d3;
padding: 16px 32px;
margin: 4px 2px;
transition-duration: 0.4s;
border-radius: 8px;
&:hover {
background-color: #3dc1d3;
color: white;
}
`;
export default ({ btnStateProp }) => {
const [btnState] = useState(btnStateProp ? btnStateProp : "main");
return (
<Header>
<Nav>
<HeaderBox>
<HeaderTitleBox>
<FontAwesomeIcon icon={faComments} />
<HeaderTitle>
<Link to="/">Linker</Link>
</HeaderTitle>
</HeaderTitleBox>
<HeaderMenuNav>
<HeaderMenuList>
<HeaderMenuItem>
<Link to="/forum">Forum</Link>
</HeaderMenuItem>
<HeaderMenuItem>
<Link to="/features">Features</Link>
</HeaderMenuItem>
<HeaderMenuItem>
<Link to="/news">News</Link>
</HeaderMenuItem>
</HeaderMenuList>
{btnState === "main" ? (
<>
<StartBox>
<StartLink to="/auth">Login</StartLink>
</StartBox>
</>
) : (
<>
<StartBox>
<StartLink to="/chat">Start</StartLink>
</StartBox>
</>
)}
</HeaderMenuNav>
</HeaderBox>
</Nav>
</Header>
);
};