React router #343
|
@ -47,6 +47,7 @@
|
||||||
"react": "^16.2.0",
|
"react": "^16.2.0",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.2.0",
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "^5.0.6",
|
||||||
|
"react-router-dom": "^4.2.2",
|
||||||
"redux": "^3.7.2",
|
"redux": "^3.7.2",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
|
|
26
react/app.js
|
@ -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')
|
|
||||||
)
|
|
15
react/components/AboutPage/index.js
Normal 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;
|
15
react/components/LoginPage/index.js
Normal 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;
|
18
react/components/PublishPage/index.js
Normal 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
|
@ -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
|
@ -0,0 +1,22 @@
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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';
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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 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 }) => (
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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}>
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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>
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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} />
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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>
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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>
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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 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 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 = {
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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,
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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 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 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;
|
||||||
Probably worth adding a 404 page or just redirect to the homepage if it doesn't find a route. Either with a 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.
|
|
@ -1,6 +1,5 @@
|
||||||
<div id="react-nav-bar"></div>
|
|
||||||
<div class="row row--tall flex-container--column">
|
<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">
|
<div class="row row--padded row--tall flex-container--column flex-container--center-center">
|
||||||
<p>loading...</p>
|
<p>loading...</p>
|
||||||
{{> progressBar}}
|
{{> progressBar}}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const Path = require('path');
|
||||||
const REACT_ROOT = Path.resolve(__dirname, 'react/');
|
const REACT_ROOT = Path.resolve(__dirname, 'react/');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry : ['whatwg-fetch', './react/app.js'],
|
entry : ['whatwg-fetch', './react/index.js'],
|
||||||
output: {
|
output: {
|
||||||
path : Path.join(__dirname, '/public/bundle/'),
|
path : Path.join(__dirname, '/public/bundle/'),
|
||||||
filename: 'bundle.js',
|
filename: 'bundle.js',
|
||||||
|
|
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 nopath
prop.