This repository was archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavbar.tsx
115 lines (111 loc) · 2.94 KB
/
navbar.tsx
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
import { useState } from 'react';
import Link from 'next/link';
import styled from '@emotion/styled';
import { useTheme } from '@geist-ui/react';
import { ArrowUpRight } from '@geist-ui/react-icons';
import { Avatar } from '@geist-ui/react';
import HamburgerButton from './hamburger-button';
import NavItem from './nav-item';
import NavDrawer from './nav-drawer';
import routes from '../routes';
/**
* Navbar.
*/
export default function Navbar(props: { activeRoute?: string }) {
const [showDrawer, setShowDrawer] = useState(false);
const theme = useTheme();
const toggleDrawer = () => setShowDrawer(!showDrawer);
const DynamicNavItem = styled(NavItem)`
@media (max-width: ${theme.breakpoints.sm.max}) {
display: none;
}
`;
return (
<>
<nav
css={{
display: 'flex',
justifyContent: 'space-between',
width: '100%',
height: 60,
backgroundColor: 'black',
}}
>
<ul
css={{
display: 'flex',
listStyle: 'none',
alignItems: 'center',
width: '100%',
maxWidth: 1200,
margin: '0 auto 0 auto',
padding: 0,
}}
>
<li
css={{
margin: '0 0 0 24px',
'&::before': {
content: 'none',
},
}}
>
<Link href="/">
<a
css={{
color: 'white',
fontSize: 18,
fontWeight: 'bold',
}}
>
turring
</a>
</Link>
</li>
<DynamicNavItem
to={routes.theory.index}
activeRoute={props.activeRoute}
>
theory
</DynamicNavItem>
<DynamicNavItem
to={routes.blog}
activeRoute={props.activeRoute}
newTab
>
blog
</DynamicNavItem>
<DynamicNavItem to={routes.contactUs} activeRoute={props.activeRoute}>
contact us
</DynamicNavItem>
</ul>
<div
css={{
display: 'flex',
justifyContent: 'right',
alignItems: 'center',
width: '100%',
marginRight: 40,
listStyle: 'none',
}}
>
<DynamicNavItem to={routes.dash} activeRoute={props.activeRoute}>
go to dashboard <ArrowUpRight size={18} color="white" />
</DynamicNavItem>
<span
css={{
marginLeft: 16,
[`@media (max-width: ${theme.breakpoints.sm.max})`]: {
display: 'none',
},
}}
>
<Avatar text="JN" />
</span>
<HamburgerButton active={showDrawer} onClick={toggleDrawer} />
</div>
</nav>
{showDrawer && <NavDrawer />}
</>
);
}