Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ikit
committed
Nov 9, 2018
1 parent
ac1d6a2
commit 1efab88
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
formations/ReacJs by Kumquats/5.1-redux/demarrage/src/js/store/configureStore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { createStore, compose, applyMiddleware } from "redux"; | ||
import reducer from "../reducers"; | ||
import thunk from "redux-thunk"; | ||
|
||
export default function() { | ||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | ||
const store = createStore(reducer, composeEnhancers( | ||
applyMiddleware(thunk) | ||
)); | ||
|
||
return store; | ||
} |
29 changes: 29 additions & 0 deletions
29
formations/ReacJs by Kumquats/6.1-react-router/demarrage/src/js/components/Menu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { Component } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export default class Menu extends Component { | ||
render() { | ||
return ( | ||
<header> | ||
<nav className="navbar navbar-inverse navbar-fixed-top"> | ||
<div className="container"> | ||
<div className="navbar-header"> | ||
<Link to="/" className="navbar-brand"> | ||
<i className="glyphicon glyphicon-film" style={{marginRight:'10px'}}></i> | ||
Reactube | ||
</Link> | ||
</div> | ||
<ul className="nav navbar-nav navbar-right"> | ||
<li> | ||
<Link to="/">Liste des vidéos</Link> | ||
</li> | ||
<li> | ||
<Link to="/videos/new">Ajouter une vidéo</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> | ||
</header> | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
formations/ReacJs by Kumquats/6.1-react-router/demarrage/src/js/containers/Layout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { Switch, Route, withRouter } from 'react-router'; | ||
import VideoList from './VideoList'; | ||
import VideoForm from './VideoForm'; | ||
import VideoDetail from './VideoDetail'; | ||
import Menu from '../components/Menu'; | ||
|
||
class Layout extends React.Component { | ||
render() { | ||
return ( | ||
<div className="container"> | ||
<Menu/> | ||
<Switch> | ||
<Route exact path="/" component={VideoList} /> | ||
<Route exact path="/videos/new" component={VideoForm} /> | ||
<Route exact path="/videos/:id" component={VideoDetail} /> | ||
</Switch> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default withRouter(Layout); |