Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit b0f7a70

Browse files
author
Rizchel Dayao
committed
Fix linting errors
1 parent 75bfabe commit b0f7a70

File tree

9 files changed

+30
-29
lines changed

9 files changed

+30
-29
lines changed

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<link rel="shortcut icon" href="">
7-
<title>React Redux Example</title>
7+
<title>Movie Finder</title>
88
</head>
99
<body>
10-
<div id="root"></div>
10+
<main id="root"></main>
1111
</body>
1212
</html>

src/actions/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
import fetch from 'isomorphic-fetch';
2-
import ActionTypes from '../constants';
1+
import fetch from 'isomorphic-fetch'
2+
import ActionTypes from '../constants'
33

4-
function retrieveMoviesStart() {
4+
// Actions for retrieving movie
5+
const retrieveMoviesStart = () => {
56
return {
67
type: ActionTypes.RETRIEVE_MOVIES_START,
78
};
89
}
910

10-
function retrieveMoviesError(error) {
11+
const retrieveMoviesError = (error) => {
1112
return {
1213
type: ActionTypes.RETRIEVE_MOVIES_ERROR,
1314
payload: error
1415
};
1516
}
1617

17-
function retrieveMoviesSuccess(response) {
18+
const retrieveMoviesSuccess = (response) => {
1819
return {
1920
type: ActionTypes.RETRIEVE_MOVIES_SUCCESS,
2021
payload: response
2122
};
2223
}
2324

24-
export function retrieveMovies(userInput) {
25+
export const retrieveMovies = (userInput) => {
2526
return dispatch => {
2627
// Insert your api key on line 30
27-
const URL = `http://www.omdbapi.com/?apikey=d8c6a83b&t=${userInput}`;
28+
const URL = `http://www.omdbapi.com/?apikey=[apiKey]&t=${userInput}`;
2829
let request = new Request(URL, {
2930
method: 'GET',
3031
});

src/components/Input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Input extends Component {
99
this.handleResponse = this.handleResponse.bind(this);
1010
}
1111

12+
//Callbacks for when user input changes or 'search' is clicked
1213
handleChange(e) {
1314
const { handleChange } = this.props;
1415
handleChange(e);
@@ -35,7 +36,7 @@ class Input extends Component {
3536
}
3637
}
3738

38-
Input.propTypes = {
39+
Input.PropTypes = {
3940
input: PropTypes.string,
4041
handleChange: PropTypes.func,
4142
handleKeyPress: PropTypes.func,

src/components/ListItem.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import React, { PropTypes, Component } from 'react';
2-
import { connect } from 'react-redux';
3-
import '../style/main.css';
1+
import React, { PropTypes, Component } from 'react'
42

53
class ListItem extends Component {
64
render() {

src/containers/App.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import React, { Component, PropTypes } from 'react'
2-
import { connect } from 'react-redux'
1+
import React, { Component } from 'react'
32
import List from './List'
4-
import InputSet from './InputSet';
5-
import * as MoviesAction from '../actions'
6-
import { bindActionCreators } from 'redux'
7-
import '../style/main.css';
3+
import InputSet from './InputSet'
84

95
class App extends Component {
106

src/containers/InputSet.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { connect } from 'react-redux'
33
import Input from '../components/Input'
44
import * as MoviesAction from '../actions'
55
import { bindActionCreators } from 'redux'
6-
import '../style/main.css';
76

87
class InputSet extends Component {
98
constructor(props) {
@@ -17,15 +16,19 @@ class InputSet extends Component {
1716
this.handleResponse = this.handleResponse.bind(this)
1817
}
1918

19+
// Function for when 'search' is clicked and retrieves movies
2020
handleResponse(input) {
2121
const { retrieveMovies } = this.props;
22+
// eslint-disable-next-line
2223
const result = retrieveMovies(input);
2324
}
2425

26+
// Function for when text in input changes
2527
handleChange(e) {
2628
this.setState({ input: e.target.value });
2729
}
2830

31+
// Function for 'enter' key press
2932
handleKeyPress(target) {
3033
const { input } = this.state;
3134
if(target.charCode===13){
@@ -35,7 +38,6 @@ class InputSet extends Component {
3538

3639
render() {
3740
const { input } = this.state;
38-
const { handleResponse } = this.props;
3941
return (
4042
<div className="input-set">
4143
<Input movieValue={input} handleChange={this.handleChange} handleKeyPress={this.handleKeyPress} handleResponse={this.handleResponse}/>
@@ -44,17 +46,20 @@ class InputSet extends Component {
4446
}
4547
}
4648

49+
// Set state and action as proptype
4750
InputSet.propTypes = {
4851
movies: PropTypes.object,
4952
retrieveMovies: PropTypes.func
5053
}
5154

55+
// Map Redux state to props
5256
function mapStateToProps(state) {
5357
return {
5458
movies: state.movies
5559
};
5660
}
5761

62+
// Map action to props
5863
function mapDispatchToProps(dispatch) {
5964
return bindActionCreators(Object.assign({}, MoviesAction), dispatch);
6065
}

src/containers/List.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React, { PropTypes, Component } from 'react';
2-
import { connect } from 'react-redux';
3-
import '../style/main.css';
4-
import ListItem from '../components/ListItem';
5-
import createList from '../utils';
1+
import React, { Component } from 'react'
2+
import { connect } from 'react-redux'
3+
import ListItem from '../components/ListItem'
4+
import createList from '../utils'
65

76
class List extends Component {
87
render() {
@@ -16,6 +15,7 @@ class List extends Component {
1615
}
1716
}
1817

18+
// Map Redux state to props
1919
function mapStateToProps(state) {
2020
return {
2121
movies: state.movies

src/reducers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { combineReducers } from 'redux';
2-
import { routerStateReducer } from 'redux-router';
1+
import { combineReducers } from 'redux'
2+
import { routerStateReducer } from 'redux-router'
33
import ActionTypes from '../constants'
44

55
const initialState = {

src/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React from 'react'
22

33
export default function createList(movies) {
44
const myList = [];

0 commit comments

Comments
 (0)