-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.jsx
More file actions
51 lines (45 loc) · 1.46 KB
/
header.jsx
File metadata and controls
51 lines (45 loc) · 1.46 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
import React from 'react';
import { connect } from 'react-redux';
import { clearFilter } from '../actions/ui_actions';
import { sidebarToggle } from '../actions/side_bar_actions';
import { withRouter, Link } from 'react-router-dom';
const sidebarClick = (props) => {
const windowWidth = window.innerWidth < 1277 ? 'overlay' : 'flex';
props.sidebarToggle(windowWidth);
};
const Header = (props) => {
return (
<div className="header-main">
<li className="side-bar-hamburger">
<i className="fa fa-bars" onClick={() => sidebarClick(props)}></i>
</li>
<li className="nav-logo">
<Link to="/" onClick={(e) => {
e.preventDefault();
props.clearFilter();
props.history.push("/");}}>
<img src="https://s3.amazonaws.com/blutube-dev/images/play_logo_small.png" />
</Link>
</li>
<li className="nav-logo-text">
<Link to="/" onClick={(e) => {
e.preventDefault();
props.clearFilter();
props.history.push("/");}}>
<span>Bl<div className="ut">uT</div>ube</span>
</Link>
</li>
</div>
);
};
const mapStateToProps = (state, ownProps) => ({
history: ownProps.history,
});
const mapDispatchToProps = (dispatch) => ({
clearFilter: () => dispatch(clearFilter()),
sidebarToggle: (windowWidth) => dispatch(sidebarToggle(windowWidth)),
});
export default withRouter(connect(
mapStateToProps,
mapDispatchToProps
)(Header));