diff --git a/.eslintcache b/.eslintcache index e827a1c..9c669f2 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"/Users/demaceovincent/rantom/src/index.js":"1","/Users/demaceovincent/rantom/src/App.js":"2","/Users/demaceovincent/rantom/src/Catalogue.js":"3","/Users/demaceovincent/rantom/src/mockData.js":"4","/Users/demaceovincent/rantom/src/MovieCard.js":"5"},{"size":198,"mtime":1606864998007,"results":"6","hashOfConfig":"7"},{"size":491,"mtime":1606867876048,"results":"8","hashOfConfig":"7"},{"size":460,"mtime":1606869592955,"results":"9","hashOfConfig":"7"},{"size":6976,"mtime":1606866733423,"results":"10","hashOfConfig":"7"},{"size":262,"mtime":1606870041064,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"dy5e4r",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/demaceovincent/rantom/src/index.js",[],"/Users/demaceovincent/rantom/src/App.js",[],"/Users/demaceovincent/rantom/src/Catalogue.js",[],"/Users/demaceovincent/rantom/src/mockData.js",[],"/Users/demaceovincent/rantom/src/MovieCard.js",[]] \ No newline at end of file +[{"/Users/demaceovincent/rantom/src/index.js":"1","/Users/demaceovincent/rantom/src/App.js":"2","/Users/demaceovincent/rantom/src/mockData.js":"3","/Users/demaceovincent/rantom/src/Components/Catalogue/Catalogue.js":"4","/Users/demaceovincent/rantom/src/Components/MovieCard/MovieCard.js":"5","/Users/demaceovincent/rantom/src/Components/SelectedMovie/SelectedMovie.js":"6","/Users/demaceovincent/rantom/src/Components/NavBar/NavBar.js":"7","/Users/demaceovincent/rantom/src/mockMovie.js":"8"},{"size":198,"mtime":1606864998007,"results":"9","hashOfConfig":"10"},{"size":1347,"mtime":1607035648950,"results":"11","hashOfConfig":"10"},{"size":6976,"mtime":1606952951770,"results":"12","hashOfConfig":"10"},{"size":601,"mtime":1607036459347,"results":"13","hashOfConfig":"10"},{"size":334,"mtime":1607034302631,"results":"14","hashOfConfig":"10"},{"size":843,"mtime":1607036765134,"results":"15","hashOfConfig":"10"},{"size":246,"mtime":1607035750849,"results":"16","hashOfConfig":"10"},{"size":630,"mtime":1607036058744,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},"dy5e4r",{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/demaceovincent/rantom/src/index.js",[],["35","36"],"/Users/demaceovincent/rantom/src/App.js",[],"/Users/demaceovincent/rantom/src/mockData.js",[],"/Users/demaceovincent/rantom/src/Components/Catalogue/Catalogue.js",[],"/Users/demaceovincent/rantom/src/Components/MovieCard/MovieCard.js",[],"/Users/demaceovincent/rantom/src/Components/SelectedMovie/SelectedMovie.js",["37"],"/Users/demaceovincent/rantom/src/Components/NavBar/NavBar.js",[],"/Users/demaceovincent/rantom/src/mockMovie.js",[],{"ruleId":"38","replacedBy":"39"},{"ruleId":"40","replacedBy":"41"},{"ruleId":"42","severity":1,"message":"43","line":12,"column":9,"nodeType":"44","endLine":12,"endColumn":52},"no-native-reassign",["45"],"no-negated-in-lhs",["46"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","JSXOpeningElement","no-global-assign","no-unsafe-negation"] \ No newline at end of file diff --git a/src/App.js b/src/App.js index e0d7cb7..3729d80 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,7 @@ import React, { Component } from 'react' -import Catalogue from './Catalogue' +import NavBar from './Components/NavBar/NavBar' +import SelectedMovie from './Components/SelectedMovie/SelectedMovie' +import Catalogue from './Components/Catalogue/Catalogue' import movieData from './mockData' import './App.css'; @@ -7,14 +9,43 @@ class App extends Component { constructor(){ super() this.state = { - movies: movieData.movies + movies: movieData.movies, + selectedMovie: 0 } } + + returnToHome = event => { + this.setState({ + selectedMovie: 0 + }) + } + + handleClick = event => { + this.setState({ + selectedMovie: event.target + }) + } + render() { return ( -

HELLOOOOOO WORLD

- + + {!this.state.selectedMovie && ( + + )} + {this.state.selectedMovie && ( + + )} + {console.log(this.state.selectedMovie)}
); } diff --git a/src/Catalogue.css b/src/Components/Catalogue/Catalogue.css similarity index 100% rename from src/Catalogue.css rename to src/Components/Catalogue/Catalogue.css diff --git a/src/Catalogue.js b/src/Components/Catalogue/Catalogue.js similarity index 70% rename from src/Catalogue.js rename to src/Components/Catalogue/Catalogue.js index 64c1bdc..6e35b9c 100644 --- a/src/Catalogue.js +++ b/src/Components/Catalogue/Catalogue.js @@ -1,15 +1,18 @@ import React from 'react' -import MovieCard from './MovieCard' +import MovieCard from '../MovieCard/MovieCard' import './Catalogue.css' function Catalogue(props){ const movieCards = props.movies.map(movie => { return( props.handleClick(event)} poster={movie.poster_path} title={movie.title} + // style={"width"="200px"} id={movie.id} key={movie.id} + handleClick={props.handleClick} /> ) }) diff --git a/src/Components/Catalogue/Catalogue.test.js b/src/Components/Catalogue/Catalogue.test.js new file mode 100644 index 0000000..8f502a0 --- /dev/null +++ b/src/Components/Catalogue/Catalogue.test.js @@ -0,0 +1,4 @@ +//it should display movies + +//it should display all movies + diff --git a/src/MovieCard.css b/src/Components/MovieCard/MovieCard.css similarity index 100% rename from src/MovieCard.css rename to src/Components/MovieCard/MovieCard.css diff --git a/src/Components/MovieCard/MovieCard.js b/src/Components/MovieCard/MovieCard.js new file mode 100644 index 0000000..2bd61cc --- /dev/null +++ b/src/Components/MovieCard/MovieCard.js @@ -0,0 +1,15 @@ +import React from 'react' +import './MovieCard.css' + +function MovieCard(props) { + return ( +
+ {props.title} +

{props.title}

+
+ ); + +} + + +export default MovieCard; \ No newline at end of file diff --git a/src/Components/MovieCard/MovieCard.test.js b/src/Components/MovieCard/MovieCard.test.js new file mode 100644 index 0000000..adcaaef --- /dev/null +++ b/src/Components/MovieCard/MovieCard.test.js @@ -0,0 +1,5 @@ +//it should display a movie poster + +//it should display a movie title + +// should be able to click on a movie card diff --git a/src/Components/NavBar/NavBar.css b/src/Components/NavBar/NavBar.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/NavBar/NavBar.js b/src/Components/NavBar/NavBar.js new file mode 100644 index 0000000..6a91cd7 --- /dev/null +++ b/src/Components/NavBar/NavBar.js @@ -0,0 +1,14 @@ +import React from "react"; +import "./NavBar.css"; + +function NavBar(props) { + return ( + + ) +} + +export default NavBar; \ No newline at end of file diff --git a/src/Components/NavBar/NavBar.test.js b/src/Components/NavBar/NavBar.test.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/SelectedMovie/SelectedMovie.css b/src/Components/SelectedMovie/SelectedMovie.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/SelectedMovie/SelectedMovie.js b/src/Components/SelectedMovie/SelectedMovie.js new file mode 100644 index 0000000..d10e018 --- /dev/null +++ b/src/Components/SelectedMovie/SelectedMovie.js @@ -0,0 +1,24 @@ +import React from 'react' +import './SelectedMovie.css' +import mockMovie from '../../mockMovie.js' + +function SelectedMovie(props) { + return ( +
+

{props.title}

+ {props.title} +

{mockMovie.movie.title}

+

{mockMovie.movie.tagline}

+ +

Overview: {mockMovie.movie.overview}

+

Release Date: {mockMovie.movie.release_date}

+

Rating: {mockMovie.movie.average_rating}

+

Genre: {mockMovie.movie.genres[0].name}

+

Budget: ${mockMovie.movie.budget}

+

Revenue: ${mockMovie.movie.revenue}

+

Duration: {mockMovie.movie.runtime} minutes

+
+ ); +} + +export default SelectedMovie \ No newline at end of file diff --git a/src/Components/SelectedMovie/SelectedMovie.test.js b/src/Components/SelectedMovie/SelectedMovie.test.js new file mode 100644 index 0000000..e69de29 diff --git a/src/MovieCard.js b/src/MovieCard.js deleted file mode 100644 index 429bda1..0000000 --- a/src/MovieCard.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import './MovieCard.css' - -function MovieCard(props) { - return ( -
- {props.title} -

{props.title}

-
- ); - -} - -export default MovieCard \ No newline at end of file diff --git a/src/mockMovie.js b/src/mockMovie.js new file mode 100644 index 0000000..50150f1 --- /dev/null +++ b/src/mockMovie.js @@ -0,0 +1,17 @@ +const mockMovie = { + "movie": { + id: 1, + title: "Fake Movie Title", + poster_path: "https://image.tmdb.org/t/p/original//7G2VvG1lU8q758uOqU6z2Ds0qpA.jpg", + backdrop_path: "https://image.tmdb.org/t/p/original//oazPqs1z78LcIOFslbKtJLGlueo.jpg", + release_date: "2019-12-04", + overview: "Some overview that is full of buzzwords to attempt to entice you to watch this movie! Explosions! Drama! True love! Robots! A cute dog!", + average_rating: 6, + genres: [{id: 18, name:"Drama"}], + budget:63000000, revenue:100853753, + runtime:139, + tagline: "It's a movie!" +} +} + +export default mockMovie; \ No newline at end of file