mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
Layout Container and Route handling
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "./node_modules/.bin/webpack --config webpack.config.js",
|
||||
"watch": "./node_modules/.bin/webpack --config webpack.config.js --watch",
|
||||
"watch": "./node_modules/.bin/webpack --config webpack.config.dev.js --watch",
|
||||
"start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142"
|
||||
},
|
||||
"keywords": [],
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import { Router, Route, Redirect, IndexRoute, IndexRedirect, browserHistory } from 'react-router';
|
||||
|
||||
import config from 'services/config'
|
||||
|
||||
import ModerationQueue from 'containers/ModerationQueue'
|
||||
import CommentStream from 'containers/CommentStream'
|
||||
import EmbedLink from 'components/EmbedLink'
|
||||
import Configure from 'containers/Configure'
|
||||
import CommunityContainer from 'containers/CommunityContainer'
|
||||
|
||||
const routes = (
|
||||
<Route path={config.base} component={LayoutContainer}>
|
||||
<IndexRoute component={ModerationQueue} />
|
||||
<Route path="embed" component={CommentStream} />
|
||||
<Route path="embedlink" component={EmbedLink} />
|
||||
<Route path="configure" component={Configure} />
|
||||
<Route path="community" component={CommunityContainer} />
|
||||
</Route>
|
||||
);
|
||||
|
||||
const AppRouter = () => <Router history={browserHistory} routes={routes} />;
|
||||
|
||||
export default AppRouter;
|
||||
@@ -1,32 +1,17 @@
|
||||
|
||||
import React from 'react'
|
||||
import { Provider } from 'react-redux'
|
||||
import { Layout } from 'react-mdl'
|
||||
import 'material-design-lite'
|
||||
import { Router, Route, browserHistory } from 'react-router'
|
||||
import ModerationQueue from 'containers/ModerationQueue'
|
||||
import { Layout } from 'react-mdl'
|
||||
import Header from 'components/Header'
|
||||
import store from 'services/store'
|
||||
import CommentStream from 'containers/CommentStream'
|
||||
import EmbedLink from 'components/EmbedLink'
|
||||
import Configure from 'containers/Configure'
|
||||
import config from 'services/config'
|
||||
|
||||
import AppRouter from '../AppRouter'
|
||||
|
||||
export default class App extends React.Component {
|
||||
render (props) {
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<Layout>
|
||||
<Header>
|
||||
<Router history={browserHistory}>
|
||||
<Route path={config.base} component={ModerationQueue}>
|
||||
<Route path="embed" component={CommentStream} />
|
||||
<Route path="embedlink" component={EmbedLink} />
|
||||
<Route path="configure" component={Configure} />
|
||||
</Route>
|
||||
</Router>
|
||||
</Header>
|
||||
</Layout>
|
||||
<AppRouter store={store} />
|
||||
</Provider>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ export default (props) => (
|
||||
<Layout fixedDrawer>
|
||||
<Header title='Talk'>
|
||||
<Navigation>
|
||||
<Link className={styles.navLink} to={`/${config.basePath}/`}>Moderate</Link>
|
||||
<Link className={styles.navLink} to={`/${config.basePath}/`}>Community</Link>
|
||||
<Link className={styles.navLink} to={`/${config.basePath}/configure`}>Configure</Link>
|
||||
<Link className={styles.navLink} to="/">Moderate</Link>
|
||||
<Link className={styles.navLink} to="community">Community</Link>
|
||||
<Link className={styles.navLink} to="configure">Configure</Link>
|
||||
</Navigation>
|
||||
</Header>
|
||||
<Drawer>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import React from 'react'
|
||||
|
||||
export const Layout = () => (
|
||||
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
import React, { Component }from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
import Layout from '../components/ui/Layout'
|
||||
|
||||
class LayoutContainer extends Component {
|
||||
render () {
|
||||
return <Layout { ...this.props } />
|
||||
}
|
||||
}
|
||||
|
||||
LayoutContainer.propTypes = {};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
data: {}
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||
dispatch
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps, null)(LayoutContainer);
|
||||
|
||||
Reference in New Issue
Block a user