import React from 'react';
import ReactDOM from 'react-dom';
import MediaQuery from 'react-responsive';
import { Route, BrowserRouter, Switch } from 'react-router-dom';
import 'antd/dist/antd.css';
import PCIndex from './components/pc_index';
import PCNewsDetails from './components/pc_news_details';
import MobileNewsDetails from './components/mobile_news_details';
import MobileIndex from './components/mobile_index';
import PCUserCenter from './components/pc_usercenter';
import MobileUserCenter from './components/mobile_usercenter';
export default class Root extends React.Component {
render() {
return (
<div>
<MediaQuery query="(min-device-width: 1224px)">
<BrowserRouter>
<Switch>
<Route exact path="/" component={PCIndex} />
<Route path="/details/:uniquekey" component={PCNewsDetails} />
<Route path="/usercenter" component={PCUserCenter} />
</Switch>
</BrowserRouter>
</MediaQuery>
<MediaQuery query="(max-device-width: 1224px)">
<BrowserRouter>
<Switch>
<Route path="/" component={MobileIndex} />
<Route path="/details/:uniquekey" component={MobileNewsDetails} />
<Route path="/usercenter" component={MobileUserCenter} />
</Switch>
</BrowserRouter>
</MediaQuery>
</div>
);
}
}
ReactDOM.render(<Root />, document.getElementById('mainContainer'));