Skip to content

Commit

Permalink
tp6
Browse files Browse the repository at this point in the history
  • Loading branch information
ikit committed Nov 9, 2018
1 parent ac1d6a2 commit 1efab88
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
@@ -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;
}
@@ -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>
);
}
}
@@ -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);

0 comments on commit 1efab88

Please sign in to comment.