This file contains hidden or 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
| import React from 'react'; | |
| import {connect} from 'react-redux'; | |
| import {Grid, Row, Col} from 'react-bootstrap'; | |
| import {AppBar, TextField, RaisedButton} from 'material-ui'; | |
| import * as movieActions from './movie-browser.actions'; | |
| import * as movieHelpers from './movie-browser.helpers'; | |
| import MovieList from './movie-list/movie-list.component'; | |
| import * as scrollHelpers from '../common/scroll.helpers'; | |
| import MovieModal from './movie-modal/movie-modal.container'; |
This file contains hidden or 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
| import React from 'react'; | |
| import {connect} from 'react-redux'; | |
| import {Card, CardTitle, CardMedia} from 'material-ui'; | |
| import {openMovieModal} from '../movie-modal/movie-modal.actions'; | |
| // These are inline styles | |
| // You can pass styles as objects using this convention | |
| const styles = { | |
| cardMedia: { | |
| maxHeight: 394, |
This file contains hidden or 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
| import React from 'react'; | |
| import {connect} from 'react-redux'; | |
| import { Dialog } from 'material-ui'; | |
| import _ from 'lodash'; | |
| import { closeMovieModal } from './movie-modal.actions'; | |
| import { getMovieDetails } from '../movie-browser.actions'; | |
| import * as movieHelpers from '../movie-browser.helpers'; | |
| import Loader from '../../common/loader.component'; | |
| const styles = { |
This file contains hidden or 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
| import {combineReducers} from 'redux'; | |
| import { createReducer, createAsyncReducer } from '../common/redux.helpers'; | |
| import { keys as movieActionKeys } from './movie-browser.actions'; | |
| import movieModalReducer from './movie-modal/movie-modal.reducer'; | |
| // This will create a new state with both the existing | |
| // movies and new pages of movies | |
| const moviesSuccessReducer = (state, action) => { | |
| const existingMovies = state.response ? state.response.results : []; | |
| // Create a new state object to be returned |
This file contains hidden or 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
| import React from 'react'; | |
| import _ from 'lodash'; | |
| import {RefreshIndicator} from 'material-ui' | |
| const styles = { | |
| refreshStyle: { | |
| position: 'relative', | |
| display: 'block', | |
| margin: '0 auto' | |
| } |
This file contains hidden or 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
| import { keys } from './movie-modal.actions'; | |
| import { createReducer } from '../../common/redux.helpers'; | |
| // Placeholder reducer for our movie modal | |
| const movieModalReducer = createReducer({ isOpen: false, movieId: undefined }, { | |
| [keys.OPEN_MOVIE_MODAL]: (state, action) => ({ | |
| isOpen: true, | |
| movieId: action.movieId | |
| }), | |
| [keys.CLOSE_MOVIE_MODAL]: (state, action) => ({ |
This file contains hidden or 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
| // List of movie modal action type keys | |
| export const keys = { | |
| 'OPEN_MOVIE_MODAL': 'OPEN_MOVIE_MODAL', | |
| 'CLOSE_MOVIE_MODAL': 'CLOSE_MOVIE_MODAL', | |
| } | |
| // Opens the <MovieModal /> with a movieId | |
| export const openMovieModal = (movieId) => { | |
| return { | |
| type: keys.OPEN_MOVIE_MODAL, |
This file contains hidden or 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
| import React from 'react'; | |
| import {connect} from 'react-redux'; | |
| import {Grid, Row, Col} from 'react-bootstrap'; | |
| import {AppBar} from 'material-ui'; | |
| import * as movieActions from './movie-browser.actions'; | |
| import * as movieHelpers from './movie-browser.helpers'; | |
| import MovieList from './movie-list/movie-list.component'; | |
| import * as scrollHelpers from '../common/scroll.helpers'; | |
| class MovieBrowser extends React.Component { |
This file contains hidden or 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
| export const getScrollDownPercentage = (window) => { | |
| const pageHeight = window.document.documentElement.scrollHeight; | |
| const clientHeight = window.document.documentElement.clientHeight; | |
| const scrollPos = window.pageYOffset; | |
| const currentPosition = scrollPos + clientHeight; | |
| const percentageScrolled = currentPosition / pageHeight; | |
| return percentageScrolled; | |
| } |
This file contains hidden or 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
| import React from 'react'; | |
| import {connect} from 'react-redux'; | |
| import {Grid, Row, Col} from 'react-bootstrap'; | |
| import {AppBar} from 'material-ui'; | |
| // e.g. { getTopMovies, ... } | |
| import * as movieActions from './movie-browser.actions'; | |
| import * as movieHelpers from './movie-browser.helpers'; | |
| import MovieList from './movie-list/movie-list.component'; | |
| class MovieBrowser extends React.Component { |
NewerOlder