Setting up router and home view (ongoing)

This commit is contained in:
Rodrigo Pedroso 2019-06-23 18:14:01 -04:00
commit b5d2cbc3c2
5 changed files with 12206 additions and 0 deletions

57
src/components/Router.jsx Normal file
View file

@ -0,0 +1,57 @@
import React from 'react'
import { Router as ReactRouter, Route, Switch } from 'react-router-dom'
import { createBrowserHistory as createHistory } from 'history'
/* Site */
import Home from 'views/Home'
import Team from 'views/Team'
import Member from 'views/Member'
const history = createHistory()
history.listen(location => {
window.scrollTo(0,0)
})
export function Router(props) {
return (
<ReactRouter history = { history }>
<Switch>
<Route exact path='/' component={Home} />
<Route exact path='/team' render={(props) => <Team {...props} />} />
<Route exact path='/member' render={(props) => <Member {...props} />} />
</Switch>
</ReactRouter>
)
}
// class Router extends React.Component {
// constructor(props) {
// super(props)
// }
// componentDidMount() {
// ReactGA.pageview(window.location.pathname)
// }
// render() {
// return (
// <ReactRouter history = { history }>
// <Switch>
// <Route exact path='/' component={Home} />
// <Route exact path='/featured' component={Featured} />
// <Route
// path="/blog"
// render={({ match: { path } }) => (
// <div>
// <Route exact path={path} render={(props) => <Blog {...props} />} />
// <Route path={`${path}/why-we-need-to-do-more-to-protect-our-children`} render={PostDoMore} />
// </div>
// )}
// />
// </Switch>
// </ReactRouter>
// )
// }
// }
// export default Router