diff --git a/screens/data-load-style.gif b/screens/data-load-style.gif new file mode 100644 index 0000000000..3a51b3ac4e Binary files /dev/null and b/screens/data-load-style.gif differ diff --git a/screens/initial-load-data.gif b/screens/initial-load-data.gif new file mode 100644 index 0000000000..e2b35e94ed Binary files /dev/null and b/screens/initial-load-data.gif differ diff --git a/src/App.js b/src/App.js index 3784575723..be9a98fb15 100644 --- a/src/App.js +++ b/src/App.js @@ -1,23 +1,11 @@ -import logo from './logo.svg'; import './App.css'; +import MovieContainer from './movies/MovieContainer'; + function App() { return (
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
+
); } diff --git a/src/App.test.js b/src/App.test.js deleted file mode 100644 index 1f03afeece..0000000000 --- a/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/src/data/movies.js b/src/data/movies.js new file mode 100644 index 0000000000..f85870d8ce --- /dev/null +++ b/src/data/movies.js @@ -0,0 +1,66 @@ + + +export const movies = [ + { + id: 1, + title: 'The Matrix', + year: 1999, + director: 'Lana Wachowski', + rating: 'R', + runtime: 136, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BNzQzOTk3OTAtNDQ0Zi00ZTVkLWI0MTEtMDllZjNkYzNjNTc4L2ltYWdlXkEyXkFqcGdeQXVyNjU0OTQ0OTY@._V1_SX300.jpg' + }, + { + id: 2, + title: 'The Lord of the Rings', + year: 2001, + director: 'Peter Jackson', + rating: 'PG-13', + runtime: 178, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BN2EyZjM3NzUtNWUzMi00MTgxLWI0NTctMzY4M2VlOTdjZWRiXkEyXkFqcGdeQXVyNDUzOTQ5MjY@._V1_SX300.jpg' + }, + { + id: 3, + title: 'The Dark Knight', + year: 2008, + director: 'Christopher Nolan', + rating: 'PG-13', + runtime: 152, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BMTMxNTMwODM0NF5BMl5BanBnXkFtZTcwODAyMTk2Mw@@._V1_SX300.jpg' + }, + { + id: 4, + title: 'Inception', + year: 2010, + director: 'Christopher Nolan', + rating: 'PG-13', + runtime: 148, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BMjAxMzY3NjcxNF5BMl5BanBnXkFtZTcwNTI5OTM0Mw@@._V1_SX300.jpg' + }, + { + id: 5, + title: 'Interstellar', + year: 2014, + director: 'Christopher Nolan', + rating: 'PG-13', + runtime: 169, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BMjIxNTU4MzY4MF5BMl5BanBnXkFtZTgwMzM4ODI3MjE@._V1_SX300.jpg' + }, + { + id: 6, + title: 'The Dark Knight Rises', + year: 2012, + director: 'Christopher Nolan', + rating: 'PG-13', + runtime: 164, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BMTk4ODQzNDY3Ml5BMl5BanBnXkFtZTcwODA0NTM4Nw@@._V1_SX300.jpg' + }, + { + id: 7, + title: 'The Lord of the Rings: The Fellowship of the Ring', + year: 2001, + director: 'Peter Jackson', + rating: 'PG-13', + runtime: 178, + poster: 'https://images-na.ssl-images-amazon.com/images/M/MV5BN2EyZjM3NzUtNWUzMi00MTgxLWI0NTctMzY4M2VlOTdjZWRiXkEyXkFqcGdeQXVyNDUzOTQ5MjY@._V1_SX300.jpg' + }]; \ No newline at end of file diff --git a/src/movies/Movie.js b/src/movies/Movie.js new file mode 100644 index 0000000000..1399958ba0 --- /dev/null +++ b/src/movies/Movie.js @@ -0,0 +1,20 @@ + +const Movie = ({movie}) => { + const { + id, + title, + year, + poster, + rating, + director} = movie; + + return ( +
  • + {title} +

    {title} by {director} was released on {year}

    +

    Rating: {rating}

    +
  • + ); +} + +export default Movie; \ No newline at end of file diff --git a/src/movies/MovieContainer.js b/src/movies/MovieContainer.js new file mode 100644 index 0000000000..8ce85e49a0 --- /dev/null +++ b/src/movies/MovieContainer.js @@ -0,0 +1,37 @@ + + +import { useEffect, useState } from 'react'; +import { movies } from '../data/movies'; +import Movie from './Movie'; +import './movies.css'; + + +const fetchMovies = () => { + return movies; +}; + +const MovieContainer = () => { + console.log(fetchMovies()); + + const [movies, setMovies] = useState([]); + + useEffect(() => { + const movies = fetchMovies(); + console.log('MovieContainer: useEffect: movies: ', movies); + setMovies(movies); + }, []); + + return( +
    +

    Movies

    + +
    + ); +}; + +export default MovieContainer; + diff --git a/src/movies/movies.css b/src/movies/movies.css new file mode 100644 index 0000000000..70e539b38c --- /dev/null +++ b/src/movies/movies.css @@ -0,0 +1,31 @@ +li { + list-style: none; +} + +.movie-container { + display: flex; + flex-direction: column; +} + +.movie-list { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-content: center; + justify-content: center; +} + +.movie { + flex: 1; + margin: 10px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 5px; + background-color: #fff; +} + +.movie img { + align-self: center; +} + +