React router #343

Merged
bones7242 merged 96 commits from react-router into master 2018-02-15 08:02:17 +01:00
9 changed files with 88 additions and 29 deletions
Showing only changes of commit c96ec875cd - Show all commits

View file

@ -47,6 +47,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"redux": "^3.7.2",
"request": "^2.83.0",
"request-promise": "^4.2.2",

View file

@ -1,26 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createStore} from 'redux';
import Reducer from 'reducers';
import Publish from 'containers/PublishTool';
import NavBar from 'containers/NavBar';
let store = createStore(
Reducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
ReactDOM.render(
<Provider store={store}>
<NavBar />
</Provider>,
document.getElementById('react-nav-bar')
)
ReactDOM.render(
<Provider store={store}>
<Publish />
</Provider>,
document.getElementById('react-publish-tool')
)

View file

@ -0,0 +1,15 @@
import React from 'react';
import NavBar from 'containers/NavBar';
class AboutPage extends React.Component {
render () {
return (
<div>
<NavBar/>
<h1>About page</h1>;
</div>
);
}
};
export default AboutPage;

View file

@ -0,0 +1,15 @@
import React from 'react';
import NavBar from 'containers/NavBar';
class PublishPage extends React.Component {
render () {
return (
<div>
<NavBar/>
<h1>Login Page</h1>
</div>
);
}
};
export default PublishPage;

View file

@ -0,0 +1,18 @@
import React from 'react';
import NavBar from 'containers/NavBar';
import PublishTool from 'containers/PublishTool';
class PublishPage extends React.Component {
render () {
return (
<div className={'row row--tall flex-container--column'}>
<NavBar/>
<div className={'row row--tall row--padded flex-container--column'}>
<PublishTool/>
</div>
</div>
);
}
};
export default PublishPage;

15
react/index.js Normal file
View file

@ -0,0 +1,15 @@
import React from 'react';
import { render } from 'react-dom';
import { createStore } from 'redux';
import Reducer from 'reducers';
import Root from './root';
let store = createStore(
Reducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
render(
<Root store={store} />,
document.getElementById('react-app')
)

22
react/root.js Normal file
View file

@ -0,0 +1,22 @@
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import React from 'react';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import PropTypes from 'prop-types';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import { Provider } from 'react-redux';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import { BrowserRouter as Router, Route } from 'react-router-dom';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import PublishPage from 'components/PublishPage';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import AboutPage from 'components/AboutPage';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
import LoginPage from 'components/LoginPage';
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
const Root = ({ store }) => (
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
<Provider store={store}>
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
<Router>
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
<Route exact path="/" component={PublishPage} />
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
</Router>
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
</Provider>
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
)
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
Root.propTypes = {
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
store: PropTypes.object.isRequired,
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
}
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.
export default Root;
neb-b commented 2018-02-05 20:10:19 +01:00 (Migrated from github.com)
Review

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a Redirect component or just a route with no path prop.

Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a `Redirect` component or just a route with no `path` prop.

View file

@ -1,6 +1,5 @@
<div id="react-nav-bar"></div>
<div class="row row--tall flex-container--column">
<div id="react-publish-tool" class="row row--padded row--tall flex-container--column">
<div id="react-app" class="row row--tall flex-container--column">
<div class="row row--padded row--tall flex-container--column flex-container--center-center">
<p>loading...</p>
{{> progressBar}}

View file

@ -3,7 +3,7 @@ const Path = require('path');
const REACT_ROOT = Path.resolve(__dirname, 'react/');
module.exports = {
entry : ['whatwg-fetch', './react/app.js'],
entry : ['whatwg-fetch', './react/index.js'],
output: {
path : Path.join(__dirname, '/public/bundle/'),
filename: 'bundle.js',