-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
57 lines (51 loc) · 1.17 KB
/
test.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
import React, {useEffect} from "react";
import {Switch, Route} from "react-router-dom";
import {NavBar, FooterNav, FooterMeta, FooterCopy} from "views/_sections";
import {Drawer, ScrollTop} from "views/_components";
import animateScrollTo from "animated-scroll-to";
import {connect} from "react-redux";
import routes from "routes.js";
const switchRoutes = (
<Switch>
{routes.map((prop, key) => {
return <Route path={prop.path} component={prop.component} key={key} />;
})}
</Switch>
);
//test
function _Landing(props) {
useEffect(() => {
const anchor = window.location.hash.toLowerCase();
if (anchor) {
let elem = document.querySelector(anchor);
if (elem) {
setTimeout(function() {
animateScrollTo(elem);
}, 500);
}
}
});
const {navOpen} = props;
return (
<>
{!navOpen && <ScrollTop />}
<Drawer />
<NavBar />
{switchRoutes}
<FooterNav />
<FooterMeta />
<FooterCopy />
</>
);
}
const mapStateToProps = state => {
const {navOpen} = state;
return {
navOpen
};
};
const Landing = connect(
mapStateToProps,
null
)(_Landing);
export default Landing;