Don't render all the movies at once

This commit is contained in:
Grégoire Delattre 2016-11-17 13:29:54 +01:00
parent 6b93ee5900
commit 11b7c08722
2 changed files with 12 additions and 1 deletions

View File

@ -84,6 +84,7 @@ ReactDOM.render((
<Route path="/users/edit" component={UserIsAuthenticated(UserEdit)} /> <Route path="/users/edit" component={UserIsAuthenticated(UserEdit)} />
<Route path="/movies/popular" component={UserIsAuthenticated(MovieListPopular)} /> <Route path="/movies/popular" component={UserIsAuthenticated(MovieListPopular)} />
<Route path="/movies/polochon" component={UserIsAuthenticated(MovieListPolochon)} /> <Route path="/movies/polochon" component={UserIsAuthenticated(MovieListPolochon)} />
<Route path="/movies/polochon/:page" component={UserIsAuthenticated(MovieListPolochon)} />
</Route> </Route>
</Router> </Router>
</Provider> </Provider>

View File

@ -2,7 +2,17 @@ import React from 'react'
import axios from 'axios' import axios from 'axios'
function MoviePosters(props) { function MoviePosters(props) {
const movies = props.movies; // TODO handle the limit from the url
const perPage = 30;
let movies;
// Let's limit the number for now
if (props.movies.length > perPage) {
movies = props.movies.slice(0, perPage);
} else {
movies = props.movies;
}
return ( return (
<div className="col-xs-5 col-md-8"> <div className="col-xs-5 col-md-8">
<div className="row"> <div className="row">