From bac3b7e7005592a4dd0ee5f19ebe2c5c27564879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHenry-Hiles=E2=80=9D?= <“henry@henryhiles.com”> Date: Mon, 7 Nov 2022 15:18:00 -0500 Subject: [PATCH] Finished up responsiveness, and made some pages more minimal --- src/components/Card.jsx | 19 +------------------ src/components/TopBar.jsx | 24 ++++++++++++++---------- src/pages/Actor.jsx | 2 +- src/pages/Home.jsx | 28 ++++++++++------------------ src/pages/Movie.jsx | 2 +- src/styles/Actor.module.css | 3 ++- src/styles/Card.module.css | 11 ----------- src/styles/Home.module.css | 2 +- src/styles/TopBar.module.css | 35 +++++++++++++++++++++++++---------- 9 files changed, 55 insertions(+), 71 deletions(-) diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 3a60963..ecad3f3 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -11,26 +11,9 @@ const Card = ({ movie, setRating }) => ( className={styles.Image} />
-

- {movie.title} - {movie.year} -

- {movie.rating ? ( + {movie.rating && ( - ) : ( -

- Average rating: {movie.averageVote}{" "} - - - -

)} -

{movie.overview}

diff --git a/src/components/TopBar.jsx b/src/components/TopBar.jsx index e95c156..c0c789c 100644 --- a/src/components/TopBar.jsx +++ b/src/components/TopBar.jsx @@ -13,6 +13,17 @@ const TopBar = ({ search, setSearch, absolute }) => { return () => window.removeEventListener("resize", handleResize) }, []) + const Search = ( + setSearch(target.value)} + /> + ) + return (
{

React Movie Finder

- {setSearch && ( - setSearch(target.value)} - /> - )} + {setSearch && width > 1000 && Search}

Your ratings

+ + {setSearch && width <= 1000 && Search}
) } diff --git a/src/pages/Actor.jsx b/src/pages/Actor.jsx index bde1403..7eeaa61 100644 --- a/src/pages/Actor.jsx +++ b/src/pages/Actor.jsx @@ -70,7 +70,7 @@ const Actor = () => {

{actor?.name}

Biography

-
+
{actor?.biography ? ( { const [movies, setMovies] = useState([]) - const [page, setPage] = useState(1) + const [page] = useState(1) const [search, setSearch] = useState("") const debouncedSearch = useDebounce(search) @@ -23,22 +22,15 @@ const Home = () => { ) const data = await response.json() setMovies( - data.results.map((movie) => ({ - id: movie.id, - overview: movie.overview, - adult: movie.adult, - posterUrl: `https://image.tmdb.org/t/p/w342${movie.poster_path}`, - backdropUrl: `https://image.tmdb.org/t/p/original${movie.backdrop_path}`, - genres: movie.genre_ids.map((genreId) => - GENRES.find((genre) => genre.id == genreId) - ), - title: movie.title, - releaseDate: movie.release_date, - year: movie.release_date.split("-")[0], - averageVote: movie.vote_average, - voteCount: movie.vote_count, - popularity: movie.popularity, - })) + data.results + .filter((movie) => movie?.poster_path) + .map((movie) => ({ + id: movie.id, + posterUrl: `https://image.tmdb.org/t/p/w342${movie.poster_path}`, + title: movie.title, + year: movie.release_date.split("-")[0], + averageVote: movie.vote_average / 2, + })) ) } diff --git a/src/pages/Movie.jsx b/src/pages/Movie.jsx index b910d8e..f4755f9 100644 --- a/src/pages/Movie.jsx +++ b/src/pages/Movie.jsx @@ -35,7 +35,7 @@ const Movie = () => { title: data.title, releaseDate: data.release_date, year: data.release_date.split("-")[0], - averageVote: data.vote_average, + averageVote: data.vote_average / 2, voteCount: data.vote_count, popularity: data.popularity, tagline: data.tagline, diff --git a/src/styles/Actor.module.css b/src/styles/Actor.module.css index 0b433d6..d9dd064 100644 --- a/src/styles/Actor.module.css +++ b/src/styles/Actor.module.css @@ -4,6 +4,7 @@ padding: 15px; color: white; } + .Name { margin-top: 10px; } @@ -35,13 +36,13 @@ .Collapse { color: white; + text-decoration: none; } .Credits { display: flex; width: 100%; gap: 20px; - height: 500px; overflow: scroll; } diff --git a/src/styles/Card.module.css b/src/styles/Card.module.css index dd04490..6461e8c 100644 --- a/src/styles/Card.module.css +++ b/src/styles/Card.module.css @@ -13,8 +13,6 @@ } .Card { - background-color: var(--primary); - padding: 12px 15px; border-radius: 7px; display: flex; gap: 5px; @@ -23,15 +21,6 @@ flex-direction: column; } -.Overview { - text-overflow: ellipsis; - overflow: hidden; - display: -webkit-box !important; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - white-space: normal; -} - .Title, .Average { margin: 0; diff --git a/src/styles/Home.module.css b/src/styles/Home.module.css index e70b607..a2b594a 100644 --- a/src/styles/Home.module.css +++ b/src/styles/Home.module.css @@ -10,7 +10,7 @@ justify-items: center; width: 85%; margin: 0 100px; - grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; text-align: center; } diff --git a/src/styles/TopBar.module.css b/src/styles/TopBar.module.css index 7f8f519..3759a0b 100644 --- a/src/styles/TopBar.module.css +++ b/src/styles/TopBar.module.css @@ -5,13 +5,32 @@ .Container { display: grid; width: 100%; - grid-template-columns: repeat(var(--cols, 2), 1fr); - padding: 0 30px; - align-items: center; - background: linear-gradient(to bottom, #00000090, #00000000); + grid-template-columns: 1fr; + padding: 10px 30px; + gap: 10px; + background: linear-gradient(to bottom, #00000090, #00000010); color: white; } +.Container h1 { + margin: 0; +} + +@media (min-width: 1000px) { + .Container { + grid-template-columns: repeat(var(--cols, 2), 1fr); + } + + .Ratings { + justify-self: end; + } + + .Search { + justify-self: center; + width: 20em; + } +} + .Container.Absolute { position: absolute; } @@ -30,13 +49,9 @@ border: 2px solid white; color: white; font: inherit; - justify-self: center; - width: 20em; + width: 100%; height: 3em; + margin-top: 10px; border-radius: 10px; background-color: var(--secondary); } - -.Ratings { - justify-self: end; -}