import React, {Component} from 'react';
import {BrowserRouter as Router, Route, Switch,withRouter} from 'react-router-dom';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import asyncComponent from '../AsyncComponent';
import ScrollToTop from 'react-router-scroll-top';
import Header from '../common/Header';
import Footer from '../common/Footer';
const ContentIndex = asyncComponent(() =>
import('../pages/ContentIndex').then(module => module.default)
);
const Catalog = asyncComponent(() =>
import('../pages/Catalog').then(module => module.default)
);
class Root extends Component {
render() {
return (
<Router>
<ScrollToTop>
<Header/>
<div className="all-data">
<Switch>
<Route exact path={"/"} component{ContentIndex}/>
<Route path={'/' + this.props.api.auto + '/:type'} component={Catalog}/>
</Switch>
</div>
<Footer/>
</ScrollToTop>
</Router>
)
}
}
function matchDispatchToProps(dispatch) {
return bindActionCreators({}, dispatch)
}
export default withRouter( connect(state => ({
api: state.api,
user: state.user
}), matchDispatchToProps)(Root) );
import React, {Component} from 'react';
import {BrowserRouter as Router, Route, Switch} from 'react-router-dom';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import ScrollToTop from 'react-router-scroll-top';
import Header from '../common/Header';
import Footer from '../common/Footer';
import ContentIndex from '../pages/ContentIndex'
import Catalog from '../pages/Catalog'
class Root extends Component {
constructor(props) {
super(props);
}
render() {
return (
<Router>
<Header/>
<div className="all-data">
<Switch>
<Route exact path={"/"} component={ContentIndex}/>
<Route path={'/catalog'} component={Catalog}/>
</Switch>
</div>
<Footer/>
</Router>
)
}
}
function matchDispatchToProps(dispatch) {
return bindActionCreators({}, dispatch)
}
export default connect(state => ({}), matchDispatchToProps)(Root);
class ModelsStat extends Component {
clickPoint( id, e ) {
console.log(document.getElementById( id );
}
render() {
return ( <div id={ 'chartItems'} onclick={this.clickPoint.bind(this, 21)}> {
this.props.auto.stat_models.map((item, index) => {
return ( < div
id={item.id}
key = {index}
className = "chart-item row" > </div>)})}
< /div>)
}
}
class ModelsStat extends Component {
clickPoint( id ) {
console.log(document.getElementById( id );
}
render() {
return ( <div id={ 'chartItems'} onclick={this.clickPoint.bind(this)}> {
this.props.auto.stat_models.map((item, index) => {
return ( < div
id={item.id}
key = {index}
className = "chart-item row" > </div>)})}
< /div>)
}
}