From 7572657243172cd764b1ce78806c4b34578073d8 Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Tue, 28 Mar 2023 14:55:17 +0200
Subject: [PATCH 01/28] created folder with components and urls
---
code/package-lock.json | 63 ++++++++++++++++++++++++++++++-
code/package.json | 3 +-
code/src/App.js | 1 +
code/src/components/Details.js | 0
code/src/components/ListMovies.js | 0
code/src/utils/urls.js | 2 +
6 files changed, 67 insertions(+), 2 deletions(-)
create mode 100644 code/src/components/Details.js
create mode 100644 code/src/components/ListMovies.js
create mode 100644 code/src/utils/urls.js
diff --git a/code/package-lock.json b/code/package-lock.json
index bb51e893e..3fa72176e 100644
--- a/code/package-lock.json
+++ b/code/package-lock.json
@@ -16,7 +16,8 @@
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "react-router-dom": "^6.9.0"
},
"devDependencies": {
"react-scripts": "5.0.1"
@@ -3124,6 +3125,14 @@
}
}
},
+ "node_modules/@remix-run/router": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.4.0.tgz",
+ "integrity": "sha512-BJ9SxXux8zAg991UmT8slpwpsd31K1dHHbD3Ba4VzD+liLQ4WAMSxQp2d2ZPRPfN0jN2NPRowcSSoM7lCaF08Q==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -14384,6 +14393,36 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-router": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.9.0.tgz",
+ "integrity": "sha512-51lKevGNUHrt6kLuX3e/ihrXoXCa9ixY/nVWRLlob4r/l0f45x3SzBvYJe3ctleLUQQ5fVa4RGgJOTH7D9Umhw==",
+ "dependencies": {
+ "@remix-run/router": "1.4.0"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "react": ">=16.8"
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.9.0.tgz",
+ "integrity": "sha512-/seUAPY01VAuwkGyVBPCn1OXfVbaWGGu4QN9uj0kCPcTyNYgL1ldZpxZUpRU7BLheKQI4Twtl/OW2nHRF1u26Q==",
+ "dependencies": {
+ "@remix-run/router": "1.4.0",
+ "react-router": "6.9.0"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "react": ">=16.8",
+ "react-dom": ">=16.8"
+ }
+ },
"node_modules/react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
@@ -19509,6 +19548,11 @@
"source-map": "^0.7.3"
}
},
+ "@remix-run/router": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.4.0.tgz",
+ "integrity": "sha512-BJ9SxXux8zAg991UmT8slpwpsd31K1dHHbD3Ba4VzD+liLQ4WAMSxQp2d2ZPRPfN0jN2NPRowcSSoM7lCaF08Q=="
+ },
"@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -27684,6 +27728,23 @@
"integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==",
"dev": true
},
+ "react-router": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.9.0.tgz",
+ "integrity": "sha512-51lKevGNUHrt6kLuX3e/ihrXoXCa9ixY/nVWRLlob4r/l0f45x3SzBvYJe3ctleLUQQ5fVa4RGgJOTH7D9Umhw==",
+ "requires": {
+ "@remix-run/router": "1.4.0"
+ }
+ },
+ "react-router-dom": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.9.0.tgz",
+ "integrity": "sha512-/seUAPY01VAuwkGyVBPCn1OXfVbaWGGu4QN9uj0kCPcTyNYgL1ldZpxZUpRU7BLheKQI4Twtl/OW2nHRF1u26Q==",
+ "requires": {
+ "@remix-run/router": "1.4.0",
+ "react-router": "6.9.0"
+ }
+ },
"react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
diff --git a/code/package.json b/code/package.json
index 7aad26ebc..9736b71ad 100644
--- a/code/package.json
+++ b/code/package.json
@@ -11,7 +11,8 @@
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "react-router-dom": "^6.9.0"
},
"scripts": {
"start": "react-scripts start",
diff --git a/code/src/App.js b/code/src/App.js
index f2007d229..00f3bedca 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -1,4 +1,5 @@
import React from 'react';
+import { BrowserRouter, Routes, Route } from 'react-router-dom';
export const App = () => {
return (
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/code/src/components/ListMovies.js b/code/src/components/ListMovies.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/code/src/utils/urls.js b/code/src/utils/urls.js
new file mode 100644
index 000000000..368b2dd9c
--- /dev/null
+++ b/code/src/utils/urls.js
@@ -0,0 +1,2 @@
+// export const BASE_URL = 'https://api.themoviedb.org/3/movie/popular?api_key=a2d2aecb5322eff67704d6c8635d60c1'
+// export const SINGLE_MOVIE_URL = (movieName) => `${BASE_URL}movie_id}`;
From 38ca598d8a01b059ae2ee26dbb704a3043afe797 Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Tue, 28 Mar 2023 18:39:25 +0200
Subject: [PATCH 02/28] Add details.js
---
code/package-lock.json | 63 +++++++++++++++++++++++++++++++++-
code/package.json | 3 +-
code/src/App.js | 23 +++++++++++--
code/src/components/Details.js | 51 +++++++++++++++++++++++++++
4 files changed, 136 insertions(+), 4 deletions(-)
create mode 100644 code/src/components/Details.js
diff --git a/code/package-lock.json b/code/package-lock.json
index bb51e893e..3fa72176e 100644
--- a/code/package-lock.json
+++ b/code/package-lock.json
@@ -16,7 +16,8 @@
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "react-router-dom": "^6.9.0"
},
"devDependencies": {
"react-scripts": "5.0.1"
@@ -3124,6 +3125,14 @@
}
}
},
+ "node_modules/@remix-run/router": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.4.0.tgz",
+ "integrity": "sha512-BJ9SxXux8zAg991UmT8slpwpsd31K1dHHbD3Ba4VzD+liLQ4WAMSxQp2d2ZPRPfN0jN2NPRowcSSoM7lCaF08Q==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -14384,6 +14393,36 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-router": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.9.0.tgz",
+ "integrity": "sha512-51lKevGNUHrt6kLuX3e/ihrXoXCa9ixY/nVWRLlob4r/l0f45x3SzBvYJe3ctleLUQQ5fVa4RGgJOTH7D9Umhw==",
+ "dependencies": {
+ "@remix-run/router": "1.4.0"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "react": ">=16.8"
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.9.0.tgz",
+ "integrity": "sha512-/seUAPY01VAuwkGyVBPCn1OXfVbaWGGu4QN9uj0kCPcTyNYgL1ldZpxZUpRU7BLheKQI4Twtl/OW2nHRF1u26Q==",
+ "dependencies": {
+ "@remix-run/router": "1.4.0",
+ "react-router": "6.9.0"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "react": ">=16.8",
+ "react-dom": ">=16.8"
+ }
+ },
"node_modules/react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
@@ -19509,6 +19548,11 @@
"source-map": "^0.7.3"
}
},
+ "@remix-run/router": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.4.0.tgz",
+ "integrity": "sha512-BJ9SxXux8zAg991UmT8slpwpsd31K1dHHbD3Ba4VzD+liLQ4WAMSxQp2d2ZPRPfN0jN2NPRowcSSoM7lCaF08Q=="
+ },
"@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -27684,6 +27728,23 @@
"integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==",
"dev": true
},
+ "react-router": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.9.0.tgz",
+ "integrity": "sha512-51lKevGNUHrt6kLuX3e/ihrXoXCa9ixY/nVWRLlob4r/l0f45x3SzBvYJe3ctleLUQQ5fVa4RGgJOTH7D9Umhw==",
+ "requires": {
+ "@remix-run/router": "1.4.0"
+ }
+ },
+ "react-router-dom": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.9.0.tgz",
+ "integrity": "sha512-/seUAPY01VAuwkGyVBPCn1OXfVbaWGGu4QN9uj0kCPcTyNYgL1ldZpxZUpRU7BLheKQI4Twtl/OW2nHRF1u26Q==",
+ "requires": {
+ "@remix-run/router": "1.4.0",
+ "react-router": "6.9.0"
+ }
+ },
"react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
diff --git a/code/package.json b/code/package.json
index 7aad26ebc..9736b71ad 100644
--- a/code/package.json
+++ b/code/package.json
@@ -11,7 +11,8 @@
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "react-router-dom": "^6.9.0"
},
"scripts": {
"start": "react-scripts start",
diff --git a/code/src/App.js b/code/src/App.js
index f2007d229..9dc00e557 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -1,9 +1,28 @@
-import React from 'react';
+/* eslint-disable no-unused-vars */
+import React, { useState, useEffect } from 'react';
+import { BrowserRouter, Routes, Route } from 'react-router-dom';
+import Details from 'components/Details';
export const App = () => {
+ const [movieList, setMovieList] = useState([]);
+ const [details, setDetails] = useState();
+
+ useEffect(() => {
+ fetch('https://api.themoviedb.org/3/movie/popular?api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US&page=1')
+ .then((response) => response.json())
+ .then((data) => setMovieList(data.results));
+ }, []);
+
return (
- Find me in src/app.js!
+
+
+
+ Welcome to my app!} />
+ } />
+
+
+
);
}
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
new file mode 100644
index 000000000..9ec6ed039
--- /dev/null
+++ b/code/src/components/Details.js
@@ -0,0 +1,51 @@
+import React, { useEffect, useState } from 'react';
+import { useNavigate, useParams } from 'react-router-dom';
+
+const Details = () => {
+ const { id } = useParams();
+ const [movie, setMovie] = useState({});
+ const API_KEY = '39168ef639d8a2d49b6d7a9893ad1b8c';
+ const API_URL_MOVIE_DETAILS = `https://api.themoviedb.org/3/movie/${id}?api_key=${API_KEY}c&language=en-US`;
+ // const API_URL_MOVIE_IMAGE = `https://api.themoviedb.org/3/configuration?api_key=${API_KEY}`;
+
+ useEffect(() => {
+ const fetchMovie = async () => {
+ try {
+ const res = await fetch(API_URL_MOVIE_DETAILS);
+ const data = await res.json();
+ setMovie(data);
+ } catch (error) {
+ console.log(error);
+ }
+ };
+ fetchMovie();
+ }, [API_URL_MOVIE_DETAILS]);
+
+ const navigate = useNavigate();
+ useEffect(() => {
+ });
+ const goBack = () => {
+ navigate(-1);
+ }
+
+ return (
+
+
Movies
+
+
+
+
+
+
+
+
{movie.title}
+
+
+
{movie.overview}
+
+
+
+ );
+};
+
+export default Details;
\ No newline at end of file
From 0af8cc2d61a9ef531f798785f9a50db62a4c35ef Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 08:17:49 +0200
Subject: [PATCH 03/28] Add link in import
---
code/src/App.js | 6 +++++-
code/src/components/Details.js | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/code/src/App.js b/code/src/App.js
index 9dc00e557..a044a3ed7 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -1,6 +1,7 @@
+/* eslint-disable react/jsx-no-comment-textnodes */
/* eslint-disable no-unused-vars */
import React, { useState, useEffect } from 'react';
-import { BrowserRouter, Routes, Route } from 'react-router-dom';
+import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
import Details from 'components/Details';
export const App = () => {
@@ -21,6 +22,9 @@ export const App = () => {
Welcome to my app!} />
} />
+
+ Go to Details
+
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index 9ec6ed039..6a85016e1 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -30,7 +30,7 @@ const Details = () => {
return (
-
Movies
+
Movies
From f077bd5c48ba1c3e2241d7f6b3e0b6377c7d3091 Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Thu, 30 Mar 2023 13:39:29 +0200
Subject: [PATCH 04/28] fixed the Movieslist component
---
code/src/App.js | 51 +++++++++++++++++++++++++++----
code/src/components/Details.js | 22 +++++++++++++
code/src/components/Header.js | 16 ++++++++++
code/src/components/ListMovies.js | 25 +++++++++++++++
code/src/components/NotFound.js | 21 +++++++++++++
code/src/utils/urls.js | 5 +--
6 files changed, 132 insertions(+), 8 deletions(-)
create mode 100644 code/src/components/Header.js
create mode 100644 code/src/components/NotFound.js
diff --git a/code/src/App.js b/code/src/App.js
index 00f3bedca..ed3d24610 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -1,10 +1,49 @@
-import React from 'react';
-import { BrowserRouter, Routes, Route } from 'react-router-dom';
+import React, { useState, useEffect } from 'react';
+import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
+import ListMovies from 'components/ListMovies';
+import NotFound from 'components/NotFound';
+import Details from 'components/Details';
+import Header from 'components/Header';
+import { BASE_URL } from 'utils/urls';
export const App = () => {
+ const [movieList, setMovieList] = useState([]);
+ const [loading, setLoading] = useState(false);
+
+ // this is borrowed from the exmaple project
+ useEffect(() => {
+ setLoading(true);
+ fetch(BASE_URL)
+ .then((response) => response.json())
+ .then((data) => {
+ setMovieList(data.results)
+ })
+ .catch((e) => {
+ console.error(e)
+ })
+ .finally(() => {
+ setLoading(false);
+ })
+ }, []);
+
+ if (loading) {
+ return (
+
Loading...
+ );
+ }
+
return (
-
- Find me in src/app.js!
-
+ // this is the main wrapper for the whole app
+
+ {/* wrapper for every component that need to be linked to */}
+
+
+ {/* path to a single component */}
+ } />
+ } />
+ } />
+ } />
+
+
);
-}
+}
\ No newline at end of file
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index e69de29bb..ba8c3d7d1 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -0,0 +1,22 @@
+import React, { useEffect } from 'react';
+import { useNavigate, useParams } from 'react-router-dom';
+
+const Details = () => {
+ const navigate = useNavigate();
+ const params = useParams();
+ const { movieName } = useParams();
+
+ useEffect(() => {
+ console.log('params', params);
+ }, [params, movieName]);
+ const onGoToNotFoundButtonClick = () => {
+ navigate('/404');
+ }
+ return (
+
+
I am the Details component
+ Go to NotFound
+ )
+}
+
+export default Details;
\ No newline at end of file
diff --git a/code/src/components/Header.js b/code/src/components/Header.js
new file mode 100644
index 000000000..d0ce24c42
--- /dev/null
+++ b/code/src/components/Header.js
@@ -0,0 +1,16 @@
+import React from 'react';
+import { NavLink } from 'react-router-dom';
+
+const Header = () => {
+ return (
+
+
+ Welcome to the Movies Page
+
+ Home
+
+
+ )
+}
+
+export default Header;
\ No newline at end of file
diff --git a/code/src/components/ListMovies.js b/code/src/components/ListMovies.js
index e69de29bb..b67c563f1 100644
--- a/code/src/components/ListMovies.js
+++ b/code/src/components/ListMovies.js
@@ -0,0 +1,25 @@
+import React from 'react';
+import { Link } from 'react-router-dom';
+
+const ListMovies = ({ listMovies }) => {
+ return (
+
+ {listMovies.map((movie) => {
+ return (
+
+
+
+
{movie.title}
+
Release date: {SVGAnimateMotionElement(movie.release_date).format('D MMM YYYY')}
+
+
+ )
+ })}
+
+ )
+}
+
+export default ListMovies;
\ No newline at end of file
diff --git a/code/src/components/NotFound.js b/code/src/components/NotFound.js
new file mode 100644
index 000000000..08d4113a3
--- /dev/null
+++ b/code/src/components/NotFound.js
@@ -0,0 +1,21 @@
+import React from 'react';
+import { useNavigate } from 'react-router-dom';
+
+const NotFound = () => {
+ const navigate = useNavigate();
+ const onGoToHomeButtonClick = () => {
+ navigate('/');
+ }
+
+ const onGoBackButtonClick = () => {
+ navigate(-1);
+ }
+ return (
+
+
Sorry, nothing here :(
+ Go to Home
+ Go back
+ )
+}
+
+export default NotFound;
\ No newline at end of file
diff --git a/code/src/utils/urls.js b/code/src/utils/urls.js
index 368b2dd9c..c5967f76a 100644
--- a/code/src/utils/urls.js
+++ b/code/src/utils/urls.js
@@ -1,2 +1,3 @@
-// export const BASE_URL = 'https://api.themoviedb.org/3/movie/popular?api_key=a2d2aecb5322eff67704d6c8635d60c1'
-// export const SINGLE_MOVIE_URL = (movieName) => `${BASE_URL}movie_id}`;
+// export const API_ID = 'a2d2aecb5322eff67704d6c8635d60c1'
+// export const BASE_URL = `https://api.themoviedb.org/3/movie/popular?api_key=${API_ID}`
+// export const SINGLE_MOVIE_URL = (id) => `${BASE_URL}/movie_id}`; ???
\ No newline at end of file
From 2ec8b7a78e169efbd388e707e0ea29099f8349c3 Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 16:04:03 +0200
Subject: [PATCH 05/28] Add styling for details
---
code/src/details.css | 72 ++++++++++++++++++++++++++++++++++++++++++++
code/src/index.css | 2 +-
2 files changed, 73 insertions(+), 1 deletion(-)
create mode 100644 code/src/details.css
diff --git a/code/src/details.css b/code/src/details.css
new file mode 100644
index 000000000..f97762911
--- /dev/null
+++ b/code/src/details.css
@@ -0,0 +1,72 @@
+h2, h3, p {
+ color: #fff;
+}
+
+.movie-details-container {
+ height: auto;
+ width: 100vw;
+ position: relative;
+ display: flex;
+ align-items: flex-end;
+}
+
+.poster-rating-container {
+ margin: 80px 20px 50px 20px;
+}
+
+.rating {
+ font-size: 20px;
+}
+
+/* Background image */
+.backdrop {
+ top: 0;
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center;
+ position: fixed;
+ height: 100%;
+ width: auto;
+ z-index: -1;
+}
+
+/* Poster image */
+.poster {
+ height: 300px;
+ width: auto;
+ border: 5px solid white;
+}
+
+/* Go back button */
+.goBackBtn {
+ display: flex;
+ align-items: center;
+ height: 25px;
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ color: white;
+ font-size: 16px;
+ text-decoration: none;
+ z-index: 2;
+}
+
+.go-back-icon {
+ width: 25px;
+ margin-right: 4px;
+}
+
+.title-rating-text {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+
+.title-details-margin {
+ margin: 16px 0 0 0;
+}
+
+.movie-description {
+ color: #fff;
+}
+
diff --git a/code/src/index.css b/code/src/index.css
index 4a1df4db7..49638f43a 100644
--- a/code/src/index.css
+++ b/code/src/index.css
@@ -10,4 +10,4 @@ body {
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
-}
+}
\ No newline at end of file
From e2dd00a5b098bc08d2a4b543f586d9ede00e0196 Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 16:04:27 +0200
Subject: [PATCH 06/28] Change API fetch
---
code/src/components/Details.js | 50 +++++++++++++++++++---------------
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index 6a85016e1..9cfab3da4 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -1,13 +1,17 @@
+/* eslint-disable max-len */
import React, { useEffect, useState } from 'react';
-import { useNavigate, useParams } from 'react-router-dom';
+import { useParams } from 'react-router-dom';
+import '../details.css';
+// Define the Details component
const Details = () => {
- const { id } = useParams();
+ // Get the movieId parameter from the URL using the useParams hook
+ const { movieId } = useParams();
+ // Define state for the movie details, initialized as an empty object
const [movie, setMovie] = useState({});
- const API_KEY = '39168ef639d8a2d49b6d7a9893ad1b8c';
- const API_URL_MOVIE_DETAILS = `https://api.themoviedb.org/3/movie/${id}?api_key=${API_KEY}c&language=en-US`;
- // const API_URL_MOVIE_IMAGE = `https://api.themoviedb.org/3/configuration?api_key=${API_KEY}`;
+ const API_URL_MOVIE_DETAILS = `https://api.themoviedb.org/3/movie/${movieId}api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US`;
+ // Define state for the movie details, initialized as an empty object
useEffect(() => {
const fetchMovie = async () => {
try {
@@ -21,26 +25,28 @@ const Details = () => {
fetchMovie();
}, [API_URL_MOVIE_DETAILS]);
- const navigate = useNavigate();
- useEffect(() => {
- });
- const goBack = () => {
- navigate(-1);
- }
-
return (
-
-
Movies
-
-
-
-
-
-
+
+ {movie.backdrop_path ? (
+
+ ) : (
+
+ )}
+
Movies
+
+
+ {movie.poster_path ? (
+
+ ) : (
+
+ )}
-
{movie.title}
+
{movie.title}Movie title
+
{Math.round(movie.vote_average * 10) / 10} Rating goes here
+
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit. Illum, assumenda soluta nisi accusantium a quo eligendi ducimus optio! Odio velit nulla officiis molestiae ducimus ratione libero tempora cumque illum ullam?
-
+
+
From 80245142f4df646ff12092cca8c6dfcf90a4bc02 Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 17:42:25 +0200
Subject: [PATCH 07/28] Add most styling for details
---
code/src/components/Details.js | 18 +++++++++++----
code/src/details.css | 42 ++++++++++++++++++++++++++++++----
2 files changed, 51 insertions(+), 9 deletions(-)
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index 9cfab3da4..a88ce3b36 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -1,3 +1,7 @@
+/* eslint-disable react/jsx-max-props-per-line */
+/* eslint-disable react/jsx-indent-props */
+/* eslint-disable react/jsx-first-prop-new-line */
+/* eslint-disable react/jsx-closing-tag-location */
/* eslint-disable max-len */
import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
@@ -32,7 +36,12 @@ const Details = () => {
) : (
)}
-
Movies
+
+ Movies
{movie.poster_path ? (
@@ -43,12 +52,11 @@ const Details = () => {
{movie.title}Movie title
{Math.round(movie.vote_average * 10) / 10} Rating goes here
-
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit. Illum, assumenda soluta nisi accusantium a quo eligendi ducimus optio! Odio velit nulla officiis molestiae ducimus ratione libero tempora cumque illum ullam?
+
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit.
+ Illum, assumenda soluta nisi accusantium a quo eligendi ducimus optio!
+ Odio velit nulla officiis molestiae ducimus ratione libero tempora cumque illum ullam?
-
);
diff --git a/code/src/details.css b/code/src/details.css
index f97762911..c9eac8990 100644
--- a/code/src/details.css
+++ b/code/src/details.css
@@ -16,6 +16,8 @@ h2, h3, p {
.rating {
font-size: 20px;
+ align-self: center;
+ margin-left: 10px;
}
/* Background image */
@@ -46,14 +48,21 @@ h2, h3, p {
top: 20px;
left: 20px;
color: white;
- font-size: 16px;
+ font-size: 18px;
text-decoration: none;
z-index: 2;
}
-.go-back-icon {
+.backBtnName {
+ margin-left: 5px;
+}
+
+.backBtnName:hover {
+ margin-left: 10px;
+}
+
+.goback-icon {
width: 25px;
- margin-right: 4px;
}
.title-rating-text {
@@ -67,6 +76,31 @@ h2, h3, p {
}
.movie-description {
- color: #fff;
+ color: #fff;
+}
+
+/* ---- DESKTOP ----- */
+@media only screen and (min-width: 1280px) {
+.title-rating-text
+{
+ bottom: 20px;
+ display: flex;
+ flex-direction: column;
+ margin-left: 370px;
+ padding-right: 50px;
+ position: fixed;
+ max-width: 400px;
+}
+
+.poster {
+ width: 342px;
+ height: auto;
+ position: fixed;
+ bottom: 50px;
}
+/* .title-details, .rating, .movie-description {
+ display: flex;
+ flex-direction: row;
+} */
+}
\ No newline at end of file
From 718bd8a42ed7ddc2f81c6866af31edfc42ad51fb Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 18:04:43 +0200
Subject: [PATCH 08/28] Add styling to movie title and description
---
code/src/components/Details.js | 40 +++++++++++++++++++---------------
code/src/details.css | 11 ++++++++--
2 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index a88ce3b36..ab38bf5f4 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -9,25 +9,29 @@ import '../details.css';
// Define the Details component
const Details = () => {
- // Get the movieId parameter from the URL using the useParams hook
- const { movieId } = useParams();
+ // Get the id parameter from the URL using the useParams hook
+ const { id } = useParams();
// Define state for the movie details, initialized as an empty object
const [movie, setMovie] = useState({});
- const API_URL_MOVIE_DETAILS = `https://api.themoviedb.org/3/movie/${movieId}api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US`;
-
// Define state for the movie details, initialized as an empty object
+ // useEffect(() => {
+ // const fetchMovie = async () => {
+ // try {
+ // const res = await fetch(API_URL_MOVIE_DETAILS);
+ // const data = await res.json();
+ // setMovie(data);
+ // } catch (error) {
+ // console.log(error);
+ // }
+ // };
+ // fetchMovie();
+ // }, [API_URL_MOVIE_DETAILS]);
+
useEffect(() => {
- const fetchMovie = async () => {
- try {
- const res = await fetch(API_URL_MOVIE_DETAILS);
- const data = await res.json();
- setMovie(data);
- } catch (error) {
- console.log(error);
- }
- };
- fetchMovie();
- }, [API_URL_MOVIE_DETAILS]);
+ fetch(`https://api.themoviedb.org/3/movie/${id}api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US`)
+ .then((data) => data.json())
+ .then((configuredData) => setMovie(configuredData))
+ }, [id]);
return (
@@ -50,8 +54,10 @@ const Details = () => {
)}
-
{movie.title}Movie title
-
{Math.round(movie.vote_average * 10) / 10} Rating goes here
+
+ {movie.title}Movie title
+ {Math.round(movie.vote_average * 10) / 10}⭐6.6
+
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit.
Illum, assumenda soluta nisi accusantium a quo eligendi ducimus optio!
Odio velit nulla officiis molestiae ducimus ratione libero tempora cumque illum ullam?
diff --git a/code/src/details.css b/code/src/details.css
index c9eac8990..dd75039b0 100644
--- a/code/src/details.css
+++ b/code/src/details.css
@@ -18,6 +18,9 @@ h2, h3, p {
font-size: 20px;
align-self: center;
margin-left: 10px;
+ background: #fff;
+ color:#000;
+ padding: 0 5px;
}
/* Background image */
@@ -71,6 +74,10 @@ h2, h3, p {
gap: 5px;
}
+.title-rating-container {
+ margin-bottom: 0;
+}
+
.title-details-margin {
margin: 16px 0 0 0;
}
@@ -83,13 +90,13 @@ h2, h3, p {
@media only screen and (min-width: 1280px) {
.title-rating-text
{
- bottom: 20px;
+ bottom: 30px;
display: flex;
flex-direction: column;
margin-left: 370px;
padding-right: 50px;
position: fixed;
- max-width: 400px;
+max-width: 400px;
}
.poster {
From cada76c06e35face540e404ca293cb164ce99f76 Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 19:43:54 +0200
Subject: [PATCH 09/28] Add margin and text shadow
---
code/src/components/Details.js | 2 +-
code/src/details.css | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index ab38bf5f4..523b9ca64 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -55,7 +55,7 @@ const Details = () => {
)}
- {movie.title}Movie title
+ {movie.title}Movie Title
{Math.round(movie.vote_average * 10) / 10}⭐6.6
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit.
diff --git a/code/src/details.css b/code/src/details.css
index dd75039b0..2c69564d0 100644
--- a/code/src/details.css
+++ b/code/src/details.css
@@ -78,6 +78,10 @@ h2, h3, p {
margin-bottom: 0;
}
+.title-details {
+ text-shadow: 1px 1px #4d4d4d;
+}
+
.title-details-margin {
margin: 16px 0 0 0;
}
@@ -90,13 +94,13 @@ h2, h3, p {
@media only screen and (min-width: 1280px) {
.title-rating-text
{
- bottom: 30px;
+ bottom: 50px;
display: flex;
flex-direction: column;
margin-left: 370px;
padding-right: 50px;
position: fixed;
-max-width: 400px;
+ max-width: 400px;
}
.poster {
From b5ec0852dbcb774c2bdf091d060821fd4ffc194c Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Thu, 30 Mar 2023 19:52:01 +0200
Subject: [PATCH 10/28] fetched the right api and made the listmovies component
work
---
code/src/App.js | 35 ++++++++++++++++++-------------
code/src/components/ListMovies.js | 35 +++++++++++++++++--------------
code/src/utils/urls.js | 7 ++++---
3 files changed, 43 insertions(+), 34 deletions(-)
diff --git a/code/src/App.js b/code/src/App.js
index ed3d24610..d4561bdd2 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -1,22 +1,22 @@
import React, { useState, useEffect } from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
-import ListMovies from 'components/ListMovies';
import NotFound from 'components/NotFound';
import Details from 'components/Details';
import Header from 'components/Header';
-import { BASE_URL } from 'utils/urls';
+import ListMovies from 'components/ListMovies';
+import { LIST_URL } from 'utils/urls.js';
export const App = () => {
- const [movieList, setMovieList] = useState([]);
+ const [listMovies, setListMovies] = useState([]);
const [loading, setLoading] = useState(false);
- // this is borrowed from the exmaple project
+ // this is borrowed from the example project
useEffect(() => {
setLoading(true);
- fetch(BASE_URL)
+ fetch(LIST_URL)
.then((response) => response.json())
.then((data) => {
- setMovieList(data.results)
+ setListMovies(data.results)
})
.catch((e) => {
console.error(e)
@@ -31,19 +31,24 @@ export const App = () => {
Loading...
);
}
+ console.log(listMovies)
return (
// this is the main wrapper for the whole app
- {/* wrapper for every component that need to be linked to */}
-
-
- {/* path to a single component */}
- } />
- } />
- } />
- } />
-
+
+
+
+
+ {/* path to a single component */}
+ } />
+ } />
+ } />
+ } />
+
+
+ {/* wrapper for every component that need to be linked to */}
+
);
}
\ No newline at end of file
diff --git a/code/src/components/ListMovies.js b/code/src/components/ListMovies.js
index b67c563f1..97c7e1637 100644
--- a/code/src/components/ListMovies.js
+++ b/code/src/components/ListMovies.js
@@ -3,22 +3,25 @@ import { Link } from 'react-router-dom';
const ListMovies = ({ listMovies }) => {
return (
-
- {listMovies.map((movie) => {
- return (
-
-
-
-
{movie.title}
-
Release date: {SVGAnimateMotionElement(movie.release_date).format('D MMM YYYY')}
-
-
- )
- })}
-
+ <>
+
test hej super hej
+
+ {listMovies.map((movie) => {
+ return (
+
+
+
+
{movie.original_title}
+ Released {movie.release_date}
+
+
+ )
+ })}
+
+ >
)
}
diff --git a/code/src/utils/urls.js b/code/src/utils/urls.js
index c5967f76a..bd34e2e66 100644
--- a/code/src/utils/urls.js
+++ b/code/src/utils/urls.js
@@ -1,3 +1,4 @@
-// export const API_ID = 'a2d2aecb5322eff67704d6c8635d60c1'
-// export const BASE_URL = `https://api.themoviedb.org/3/movie/popular?api_key=${API_ID}`
-// export const SINGLE_MOVIE_URL = (id) => `${BASE_URL}/movie_id}`; ???
\ No newline at end of file
+const apiKey = '012b5e0d6a17064c1b4e1d5d9021d5ae'
+
+export const LIST_URL = `https://api.themoviedb.org/3/movie/popular?api_key=${apiKey}&language=en-US&page=1`
+export const SINGLE_MOVIE_URL = (id) => `https://api.themoviedb.org/3/movie/${id}?api_key=${apiKey}&language=en-US&page=1`
\ No newline at end of file
From 2632a9256d3d75cacd6e5f04712f30522c3e0f03 Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Thu, 30 Mar 2023 19:55:30 +0200
Subject: [PATCH 11/28] typo in component
---
code/src/utils/urls.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/src/utils/urls.js b/code/src/utils/urls.js
index bd34e2e66..d4ca98da8 100644
--- a/code/src/utils/urls.js
+++ b/code/src/utils/urls.js
@@ -1,4 +1,4 @@
-const apiKey = '012b5e0d6a17064c1b4e1d5d9021d5ae'
+const apiKey = 'a2d2aecb5322eff67704d6c8635d60c1'
export const LIST_URL = `https://api.themoviedb.org/3/movie/popular?api_key=${apiKey}&language=en-US&page=1`
export const SINGLE_MOVIE_URL = (id) => `https://api.themoviedb.org/3/movie/${id}?api_key=${apiKey}&language=en-US&page=1`
\ No newline at end of file
From 040eb20edcc957cded236cf17c362906e5d251ab Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 20:42:31 +0200
Subject: [PATCH 12/28] Fix API fetch, remove placeholder images
---
code/src/components/Details.js | 46 +++++++---------------------------
1 file changed, 9 insertions(+), 37 deletions(-)
diff --git a/code/src/components/Details.js b/code/src/components/Details.js
index 523b9ca64..41f65921b 100644
--- a/code/src/components/Details.js
+++ b/code/src/components/Details.js
@@ -12,55 +12,27 @@ const Details = () => {
// Get the id parameter from the URL using the useParams hook
const { id } = useParams();
// Define state for the movie details, initialized as an empty object
- const [movie, setMovie] = useState({});
- // Define state for the movie details, initialized as an empty object
- // useEffect(() => {
- // const fetchMovie = async () => {
- // try {
- // const res = await fetch(API_URL_MOVIE_DETAILS);
- // const data = await res.json();
- // setMovie(data);
- // } catch (error) {
- // console.log(error);
- // }
- // };
- // fetchMovie();
- // }, [API_URL_MOVIE_DETAILS]);
+ const [movieDetail, setMovieDetail] = useState({});
useEffect(() => {
- fetch(`https://api.themoviedb.org/3/movie/${id}api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US`)
+ fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=39168ef639d8a2d49b6d7a9893ad1b8c&language=en-US`)
.then((data) => data.json())
- .then((configuredData) => setMovie(configuredData))
+ .then((configuredData) => setMovieDetail(configuredData))
}, [id]);
return (
- {movie.backdrop_path ? (
-
- ) : (
-
- )}
-
- Movies
+
+
Movies
- {movie.poster_path ? (
-
- ) : (
-
- )}
+
- {movie.title}Movie Title
- {Math.round(movie.vote_average * 10) / 10}⭐6.6
+ {movieDetail.title}
+ ⭐{Math.round(movieDetail.vote_average * 10) / 10}
-
{movie.overview}Description Lorem ipsum dolor sit amet consectetur adipisicing elit.
- Illum, assumenda soluta nisi accusantium a quo eligendi ducimus optio!
- Odio velit nulla officiis molestiae ducimus ratione libero tempora cumque illum ullam?
+
{movieDetail.overview}
From ca3fd15d2642b03fda6f2f22f188f778d994a8bc Mon Sep 17 00:00:00 2001
From: smirrebinx <48405465+smirrebinx@users.noreply.github.com>
Date: Thu, 30 Mar 2023 20:42:57 +0200
Subject: [PATCH 13/28] Add styling to title-rating text
Fix responsivity
---
code/src/details.css | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/code/src/details.css b/code/src/details.css
index 2c69564d0..60ee94ba7 100644
--- a/code/src/details.css
+++ b/code/src/details.css
@@ -52,6 +52,7 @@ h2, h3, p {
left: 20px;
color: white;
font-size: 18px;
+ font-weight: 700;
text-decoration: none;
z-index: 2;
}
@@ -72,6 +73,10 @@ h2, h3, p {
display: flex;
flex-direction: column;
gap: 5px;
+ padding: 2px 3px 2px 8px;
+ background-color:rgba(40,39,39,.7);
+ border-radius: 4px;
+ margin-top: 5px;
}
.title-rating-container {
@@ -90,15 +95,37 @@ h2, h3, p {
color: #fff;
}
+/* ---- TABLET ----- */
+@media only screen and (min-width: 744px) {
+ .title-rating-text {
+ max-width: 400px;
+ }
+}
+
/* ---- DESKTOP ----- */
@media only screen and (min-width: 1280px) {
+.goBackBtn {
+ margin-left: 30px;
+ margin-top: 30px;
+ }
+
+.backdrop {
+ top: 0;
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center;
+ position: fixed;
+ height: 100%;
+ width: 100%; /* updated */
+ z-index: -1;
+}
+
.title-rating-text
{
bottom: 50px;
display: flex;
flex-direction: column;
- margin-left: 370px;
- padding-right: 50px;
+ margin-left: 400px;
position: fixed;
max-width: 400px;
}
@@ -108,10 +135,8 @@ h2, h3, p {
height: auto;
position: fixed;
bottom: 50px;
+ margin-left: 30px;
+ margin-right: 20px;
}
-/* .title-details, .rating, .movie-description {
- display: flex;
- flex-direction: row;
-} */
}
\ No newline at end of file
From d2e5a6333d78118d61e6069f9521f0128831d4c2 Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Thu, 30 Mar 2023 22:47:29 +0200
Subject: [PATCH 14/28] styling for the branch stylinglistmovies
---
code/package-lock.json | 31 ++++++++++++++
code/package.json | 2 +
code/src/components/ListMovies.js | 37 +++++++++--------
code/src/listmovies.css | 67 +++++++++++++++++++++++++++++++
code/src/utils/urls.js | 1 -
5 files changed, 118 insertions(+), 20 deletions(-)
create mode 100644 code/src/listmovies.css
diff --git a/code/package-lock.json b/code/package-lock.json
index 3fa72176e..964acdc50 100644
--- a/code/package-lock.json
+++ b/code/package-lock.json
@@ -15,8 +15,10 @@
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
+ "moment": "^2.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-moment": "^1.1.3",
"react-router-dom": "^6.9.0"
},
"devDependencies": {
@@ -12017,6 +12019,14 @@
"mkdirp": "bin/cmd.js"
}
},
+ "node_modules/moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -14384,6 +14394,16 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
+ "node_modules/react-moment": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/react-moment/-/react-moment-1.1.3.tgz",
+ "integrity": "sha512-8EPvlUL8u6EknPp1ISF5MQ3wx2OHJVXIP/iZc4wRh3iV3XozftZERDv9ANZeAtMlhNNQHdFoqcZHFUkBSTONfA==",
+ "peerDependencies": {
+ "moment": "^2.29.0",
+ "prop-types": "^15.7.0",
+ "react": "^16.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/react-refresh": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
@@ -26161,6 +26181,11 @@
"minimist": "^1.2.6"
}
},
+ "moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
+ },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -27722,6 +27747,12 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
+ "react-moment": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/react-moment/-/react-moment-1.1.3.tgz",
+ "integrity": "sha512-8EPvlUL8u6EknPp1ISF5MQ3wx2OHJVXIP/iZc4wRh3iV3XozftZERDv9ANZeAtMlhNNQHdFoqcZHFUkBSTONfA==",
+ "requires": {}
+ },
"react-refresh": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
diff --git a/code/package.json b/code/package.json
index 9736b71ad..db73fce7e 100644
--- a/code/package.json
+++ b/code/package.json
@@ -10,8 +10,10 @@
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
+ "moment": "^2.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-moment": "^1.1.3",
"react-router-dom": "^6.9.0"
},
"scripts": {
diff --git a/code/src/components/ListMovies.js b/code/src/components/ListMovies.js
index 97c7e1637..534a2e68b 100644
--- a/code/src/components/ListMovies.js
+++ b/code/src/components/ListMovies.js
@@ -1,27 +1,26 @@
import React from 'react';
import { Link } from 'react-router-dom';
+import moment from 'moment';
+import '../listmovies.css';
const ListMovies = ({ listMovies }) => {
return (
- <>
-
test hej super hej
-
- {listMovies.map((movie) => {
- return (
-
-
-
-
{movie.original_title}
- Released {movie.release_date}
-
-
- )
- })}
-
- >
+
+ {listMovies.map((movie) => {
+ return (
+
+
+
+
{movie.original_title}
+
Released: {moment(movie.release_date).format('D MMMM YYYY')}
+
+
+ )
+ })}
+
)
}
diff --git a/code/src/listmovies.css b/code/src/listmovies.css
new file mode 100644
index 000000000..921415600
--- /dev/null
+++ b/code/src/listmovies.css
@@ -0,0 +1,67 @@
+.movies-list {
+ display: flex;
+ flex-wrap: wrap;
+ }
+
+ .single-movie {
+ width: 25%;
+ size: fit-content;
+ position: relative;
+ display: flex;
+ flex-wrap: wrap;
+ }
+
+ .hover-container {
+ color: rgb(241, 242, 246);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ padding: 45% 5%;
+ }
+
+ .single-movie .hover-container {
+ border: 5px solid black;
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ text-align: center;
+ }
+
+ .text-hover {
+ display: none;
+ }
+
+ .single-movie:hover .hover-container {
+ display: flex;
+ flex-direction: column;
+ text-align: center;
+ justify-content: flex-end;
+ background: rgba(0,0,0,.75);
+ }
+
+ .single-movie:hover .hover-container .text-hover {
+ display: flex;
+ flex-direction: column;
+ text-align: center;
+ justify-content: flex-end;
+ }
+
+ .cover-image {
+ width: 100%;
+ }
+
+ @media (min-width: 0px) and (max-width: 570px) {
+ .single-movie {
+ width: 100%;
+ }
+
+ }
+
+ @media (min-width: 571px) and (max-width: 850px) {
+ .single-movie{
+ width: 33.33%;
+ }
+
+}
+
\ No newline at end of file
diff --git a/code/src/utils/urls.js b/code/src/utils/urls.js
index d4ca98da8..fe8972ed7 100644
--- a/code/src/utils/urls.js
+++ b/code/src/utils/urls.js
@@ -1,4 +1,3 @@
const apiKey = 'a2d2aecb5322eff67704d6c8635d60c1'
export const LIST_URL = `https://api.themoviedb.org/3/movie/popular?api_key=${apiKey}&language=en-US&page=1`
-export const SINGLE_MOVIE_URL = (id) => `https://api.themoviedb.org/3/movie/${id}?api_key=${apiKey}&language=en-US&page=1`
\ No newline at end of file
From eb07e54ff3c6d77b7c3095d15324234535ae95f7 Mon Sep 17 00:00:00 2001
From: majazimnoch <120421674+majazimnoch@users.noreply.github.com>
Date: Fri, 31 Mar 2023 00:41:30 +0200
Subject: [PATCH 15/28] styling general and header
---
code/src/App.js | 2 -
code/src/assets/github.png | Bin 0 -> 1758 bytes
code/src/assets/movie.png | Bin 0 -> 1456678 bytes
code/src/components/Header.js | 18 +++++--
code/src/components/ListMovies.js | 36 +++++++------
code/src/header.css | 83 ++++++++++++++++++++++++++++++
code/src/index.css | 10 ++++
7 files changed, 127 insertions(+), 22 deletions(-)
create mode 100644 code/src/assets/github.png
create mode 100644 code/src/assets/movie.png
create mode 100644 code/src/header.css
diff --git a/code/src/App.js b/code/src/App.js
index d4561bdd2..bbe9a860f 100644
--- a/code/src/App.js
+++ b/code/src/App.js
@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import NotFound from 'components/NotFound';
import Details from 'components/Details';
-import Header from 'components/Header';
import ListMovies from 'components/ListMovies';
import { LIST_URL } from 'utils/urls.js';
@@ -38,7 +37,6 @@ export const App = () => {