-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathindex.js
67 lines (60 loc) · 2.28 KB
/
index.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
import React, { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import Logo from '../Logo';
import * as S from './styled';
export default function Header() {
const location = useLocation();
const [clicked, setClicked] = useState(false);
useEffect(() => {
setClicked(false);
}, [location]);
return (
<S.Header>
<Logo />
<S.MenuMobile onClick={() => setClicked(!clicked)}>
{!clicked ? (
<FontAwesomeIcon icon={faBars} aria-label="menu closed" />
) : (
<FontAwesomeIcon icon={faTimes} aria-label="menu opened" />
)}
</S.MenuMobile>
<S.Menu open={!clicked}>
<ul>
<li>
<S.StyledLink activeClassName="is-active" to="/" exact>
Início
</S.StyledLink>
</li>
<li>
<S.StyledLink
activeClassName="is-active"
to="/challenges"
>
Desafios
</S.StyledLink>
</li>
<li>
<S.StyledLink activeClassName="is-active" to="/devs">
Comunidade
</S.StyledLink>
</li>
<li>
<S.ButtonLink
activeClassName="is-active"
href={`https://github.com/login/oauth/authorize?scope=userl&client_id=${process.env.REACT_APP_CLIENT_ID}`}
>
Entrar
<FontAwesomeIcon
icon={faGithub}
style={{ marginLeft: '10px' }}
/>
</S.ButtonLink>
</li>
</ul>
</S.Menu>
</S.Header>
);
}