forked from hackforla/VRMS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheader.js
More file actions
56 lines (50 loc) · 1.65 KB
/
header.js
File metadata and controls
56 lines (50 loc) · 1.65 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
import React from 'react';
import './header.scss';
import laLogo from '../../../assets/images/la-logo.svg';
import stlLogo from '../../../assets/images/stl-logo.svg'
import RedirectLink from '../link/link';
import { useSelector, useDispatch } from 'react-redux';
import allActions from '../../../store/actions';
import { BRIGADE_NAME } from '../../../utils/themes/themes';
import { useState, useEffect } from 'react';
const Header = () => {
const isMenuOpen = useSelector((state) => state.dashboard.isMenuOpen);
const loggedIn = useSelector((state) => state.auth.loggedIn);
const user = useSelector((state) => state.auth.user);
const dispatch = useDispatch();
const [logo, setLogo] = useState();
useEffect(() => {
BRIGADE_NAME === "Hack for LA" ? setLogo(laLogo) : setLogo(stlLogo)
}, []);
function toggleMenu() {
if (!isMenuOpen) {
dispatch(allActions.dashboardActions.openMenu());
} else {
dispatch(allActions.dashboardActions.closeMenu());
}
}
return (
<header data-testid="header" className="app-header">
{loggedIn && user ? (
<div className="menu-button-container">
<div
className={isMenuOpen ? 'menu-button active' : 'menu-button'}
onClick={() => toggleMenu()}
>
<span className="line" />
<span className="line" />
<span className="line" />
</div>
</div>
) : null}
<RedirectLink
linkKey={'header-home-link'}
path={'/'}
content={
<img data-testid="logo" src={logo} className="app-logo" alt="logo" />
}
/>
</header>
);
};
export default Header;