-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathHeader.tsx
More file actions
206 lines (196 loc) · 5.6 KB
/
Header.tsx
File metadata and controls
206 lines (196 loc) · 5.6 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import { useRef } from "react";
import { NavLink } from "react-router-dom";
import {
Box,
chakra,
Flex,
HStack,
Image,
Spacer,
Text,
Button,
List,
ListItem,
Link as ChakraLink,
useMediaQuery,
useDisclosure,
Drawer,
DrawerOverlay,
DrawerContent,
VStack,
DrawerCloseButton,
} from "@chakra-ui/react";
import { HamburgerIcon } from "@chakra-ui/icons";
const Link = chakra(NavLink);
const links = [
{
id: 1,
to: "/",
label: "Assistir",
},
{
id: 2,
to: "/sobre",
label: "Sobre",
},
// {
// id: 3,
// to: "/estatisticas",
// label: "Estatísticas",
// },
// {
// id: 4,
// to: "/agradecimentos",
// label: "Agradecimentos",
// },
];
export default function Header() {
const [isLargerThanLg] = useMediaQuery("(min-width: 62em)");
const { isOpen, onOpen, onClose } = useDisclosure();
const buttonRef = useRef(null);
return (
<>
<Flex p={4} borderBottomColor={"whiteAlpha.100"} borderBottomWidth={1} alignItems="center" as="header">
<Link to="/">
<HStack>
<Image src="/logo.svg" alt="Br Dev Streamers" height={50} width={50} />
<Box textAlign={"center"}>
<Text className="logo-title">BR Dev Streamers</Text>
<Text mt={-2} className="logo-subtitle">
Unindo a comunidade de Live Coding
</Text>
</Box>
</HStack>
</Link>
<Spacer />
{isLargerThanLg && (
<>
<HStack gap={4} as="nav">
<List display="flex" gap={4}>
{links.map((link) => (
<ListItem key={link.id}>
<Link
to={link.to}
color={"gray.100"}
_activeLink={{
color: "primary.500",
}}
_hover={{ textDecoration: "underline" }}
data-test="header-link"
>
{link.label}
</Link>
</ListItem>
))}
</List>
</HStack>
<Spacer />
<HStack gap={4} as="nav">
<List display="flex" gap={4}>
<ListItem>
<ChakraLink
isExternal={true}
href={"https://github.com/brdevstreamers"}
color={"gray.100"}
_hover={{ textDecoration: "underline" }}
data-test="header-link"
>
GitHub
</ChakraLink>
</ListItem>
<ListItem>
<ChakraLink
isExternal={true}
href={"https://discord.gg/collabcode"}
color={"gray.100"}
_hover={{ textDecoration: "underline" }}
data-test="header-link"
>
Discord
</ChakraLink>
</ListItem>
</List>
{/* <Button
bgColor={"primary.500"}
borderRadius={"sm"}
_hover={{ bgColor: "primary.600", color: "primary.400" }}
>
Logar com twitch
</Button> */}
</HStack>
</>
)}
{!isLargerThanLg && (
<Button
ref={buttonRef}
size="xs"
rounded="sm"
bgColor="blackAlpha.500"
color="gray.100"
_hover={{
filter: "brightness(0.9)",
}}
leftIcon={<HamburgerIcon />}
onClick={onOpen}
>
Menu
</Button>
)}
</Flex>
<Drawer isOpen={isOpen} placement="right" onClose={onClose} finalFocusRef={buttonRef}>
<DrawerOverlay />
<DrawerContent bgColor="secondary.600" color="gray.100" px={4} pt={16}>
<DrawerCloseButton aria-label="Fechar" />
<VStack alignItems="start">
<List display="flex" flexDirection="column" gap={4} width="100%">
{links.map((link) => (
<ListItem key={link.id} display="flex">
<Link
to={link.to}
w="full"
p={2}
rounded="sm"
color={"gray.100"}
_activeLink={{
color: "primary.500",
bgColor: "blackAlpha.500",
}}
_hover={{ bgColor: "blackAlpha.500" }}
>
{link.label}
</Link>
</ListItem>
))}
<ListItem display="flex">
<ChakraLink
isExternal={true}
href={"https://github.com/brdevstreamers"}
color={"gray.100"}
w="full"
p={2}
rounded="sm"
_hover={{ bgColor: "blackAlpha.500" }}
>
GitHub
</ChakraLink>
</ListItem>
<ListItem display="flex">
<ChakraLink
isExternal={true}
href={"https://discord.gg/collabcode"}
p={2}
w="full"
rounded="sm"
color={"gray.100"}
_hover={{ bgColor: "blackAlpha.500" }}
>
Discord
</ChakraLink>
</ListItem>
</List>
</VStack>
</DrawerContent>
</Drawer>
</>
);
}