mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Wired redux
This commit is contained in:
parent
b1e97ef022
commit
e150b35e33
7 changed files with 43 additions and 10 deletions
|
@ -41,6 +41,7 @@
|
|||
"react-redux": "^5.0.7",
|
||||
"react-router-dom": "^4.2.2",
|
||||
"reactstrap": "^6.0.1",
|
||||
"redux": "^4.0.0",
|
||||
"resolve": "1.6.0",
|
||||
"style-loader": "0.19.0",
|
||||
"sw-precache-webpack-plugin": "0.11.4",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import React from 'react';
|
||||
import './App.scss';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import './App.scss';
|
||||
import Home from './common/Home';
|
||||
import MainHeader from './common/MainHeader';
|
||||
import MenuLayout from './common/MenuLayout';
|
||||
import CreateServer from './servers/CreateServer';
|
||||
|
||||
export default class App extends React.Component {
|
||||
|
@ -10,10 +11,12 @@ export default class App extends React.Component {
|
|||
return (
|
||||
<div>
|
||||
<MainHeader/>
|
||||
|
||||
<div className="app">
|
||||
<Switch>
|
||||
<Route path="/server/create" component={CreateServer} />
|
||||
<Route path="/" component={Home} />
|
||||
<Route exact path="/server/create" component={CreateServer} />
|
||||
<Route exact path="/" component={Home} />
|
||||
<Route component={MenuLayout} />
|
||||
</Switch>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class MainHeader extends React.Component {
|
|||
super(props);
|
||||
|
||||
this.state = {
|
||||
isOpen: false
|
||||
isOpen: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
13
src/common/MenuLayout.js
Normal file
13
src/common/MenuLayout.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import React from 'react';
|
||||
import { Switch } from 'react-router-dom';
|
||||
|
||||
export default () => {
|
||||
return (
|
||||
<div>
|
||||
<nav>Left menu</nav>
|
||||
<Switch>
|
||||
|
||||
</Switch>
|
||||
</div>
|
||||
);
|
||||
}
|
14
src/index.js
14
src/index.js
|
@ -1,15 +1,23 @@
|
|||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import './index.scss';
|
||||
import { Provider } from 'react-redux';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { applyMiddleware, createStore } from 'redux';
|
||||
import App from './App';
|
||||
import './index.scss';
|
||||
import reducers from './reducers';
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
|
||||
// const store = createStore(reducers, {}, applyMiddleware());
|
||||
const store = createStore(reducers, applyMiddleware());
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>,
|
||||
</BrowserRouter>
|
||||
</Provider>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
registerServiceWorker();
|
||||
|
|
5
src/reducers/index.js
Normal file
5
src/reducers/index.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { combineReducers } from 'redux';
|
||||
|
||||
const rootReducer = combineReducers({});
|
||||
|
||||
export default rootReducer;
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
export default class ServersDropdown extends React.Component {
|
||||
class ServersDropdown extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<UncontrolledDropdown nav>
|
||||
|
@ -21,3 +22,5 @@ export default class ServersDropdown extends React.Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect()(ServersDropdown);
|
||||
|
|
Loading…
Reference in a new issue