From 5a5038768543ee72a352c617f44187a0069c1e49 Mon Sep 17 00:00:00 2001 From: Norbert Maciaszek Date: Wed, 13 Aug 2025 17:13:20 +0200 Subject: [PATCH] Update global styles and refactor MovieList component: change text color in globals.css, enhance MovieList filtering logic with numeric props, and improve MovieCard layout for better UI consistency. --- src/app/(withGlobalData)/page.tsx | 13 +++-- src/app/globals.css | 50 +++++-------------- src/components/atoms/MovieCard/index.tsx | 4 +- src/components/atoms/ReadMore/index.tsx | 2 +- src/components/molecules/MovieList/index.tsx | 39 +++++++++------ .../Navbar/components/Search/index.tsx | 6 +-- src/components/organisms/Navbar/index.tsx | 4 +- 7 files changed, 55 insertions(+), 63 deletions(-) diff --git a/src/app/(withGlobalData)/page.tsx b/src/app/(withGlobalData)/page.tsx index 4fed65e..dbe2572 100644 --- a/src/app/(withGlobalData)/page.tsx +++ b/src/app/(withGlobalData)/page.tsx @@ -3,10 +3,15 @@ import { MovieList } from "@/components/molecules/MovieList"; export default async function Home() { return ( <> - - - - + + + + ); } diff --git a/src/app/globals.css b/src/app/globals.css index 051d4bc..9f41d73 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -3,7 +3,7 @@ @custom-variant dark (&:is(.dark *)); @theme { - --color-text: #1d1d1d; + --color-text: #fafafa; --color-primary-50: #eefaff; --color-primary-100: #dcf5ff; @@ -17,41 +17,17 @@ --color-primary-900: #00547a; --color-primary-950: #003049; - --color-secondary-50: #ffeeee; - --color-secondary-100: #ffdada; - --color-secondary-200: #ffbbbb; - --color-secondary-300: #ff8b8b; - --color-secondary-400: #ff4949; - --color-secondary-500: #ff1111; - --color-secondary-600: #ff0000; - --color-secondary-700: #e70000; - --color-secondary: #be0000; - --color-secondary-900: #780000; - --color-secondary-950: #560000; - - --color-monza-50: #fff1f2; - --color-monza-100: #ffe0e2; - --color-monza-200: #ffc7cb; - --color-monza-300: #ffa0a7; - --color-monza-400: #ff6974; - --color-monza-500: #fa3947; - --color-monza-600: #e71b2a; - --color-monza-700: #c1121f; - --color-monza-800: #a1131e; - --color-monza-900: #85171f; - --color-monza-950: #49060b; - - --color-pink-lady-50: #fef9ee; - --color-pink-lady-100: #fdf0d5; - --color-pink-lady-200: #fadfae; - --color-pink-lady-300: #f7c77a; - --color-pink-lady-400: #f2a545; - --color-pink-lady-500: #ef8a20; - --color-pink-lady-600: #e07016; - --color-pink-lady-700: #ba5514; - --color-pink-lady-800: #944418; - --color-pink-lady-900: #773917; - --color-pink-lady-950: #401c0a; + --color-secondary-50: #fef9ee; + --color-secondary-100: #fdf0d5; + --color-secondary-200: #fadfae; + --color-secondary-300: #f7c77a; + --color-secondary-400: #f2a545; + --color-secondary-500: #ef8a20; + --color-secondary: #e07016; + --color-secondary-700: #ba5514; + --color-secondary-800: #944418; + --color-secondary-900: #773917; + --color-secondary-950: #401c0a; --color-hippie-blue-50: #f4f7fb; --color-hippie-blue-100: #e9eff5; @@ -72,7 +48,7 @@ @layer base { body { - @apply bg-pink-lady-50 text-text; + @apply bg-hippie-blue-950 text-text; } .container { diff --git a/src/components/atoms/MovieCard/index.tsx b/src/components/atoms/MovieCard/index.tsx index a2d1795..0fa3dac 100644 --- a/src/components/atoms/MovieCard/index.tsx +++ b/src/components/atoms/MovieCard/index.tsx @@ -55,7 +55,7 @@ export const MovieCard: FC = ({ layout = "default", ...movie }) => { if (layout === "zeus") { return ( -
+
= ({ layout = "default", ...movie }) => {

{isReleased ? : } diff --git a/src/components/atoms/ReadMore/index.tsx b/src/components/atoms/ReadMore/index.tsx index 574730e..5bb80c8 100644 --- a/src/components/atoms/ReadMore/index.tsx +++ b/src/components/atoms/ReadMore/index.tsx @@ -12,7 +12,7 @@ export const ReadMore: FC = ({ text }) => {

setIsOpen(!isOpen)} > {text} diff --git a/src/components/molecules/MovieList/index.tsx b/src/components/molecules/MovieList/index.tsx index 60f9cf5..022ba99 100644 --- a/src/components/molecules/MovieList/index.tsx +++ b/src/components/molecules/MovieList/index.tsx @@ -10,10 +10,10 @@ type Props = { heading?: string; overrideMovies?: Movie[]; - filterSeen?: boolean; - filterFavorites?: boolean; - filterUpcoming?: boolean; - filterReleased?: boolean; + filterSeen?: 0 | 1; + filterFavorites?: 0 | 1; + filterUpcoming?: 0 | 1; + filterReleased?: 0 | 1; fluid?: boolean; showFilters?: boolean; @@ -43,12 +43,23 @@ export const MovieList: FC = ({ const filteredMovies = movies.filter((movie) => { let result = true; - if (filterSeen) result = !!movie.seen; - if (filterFavorites) result = result && !!movie.favorite; - if (filterUpcoming) - result = result && new Date(movie.release_date) > new Date(); - if (filterReleased) - result = result && new Date(movie.release_date) < new Date(); + const today = new Date(); + if (filterSeen !== undefined) { + result = movie.seen === !!filterSeen; + } + if (filterFavorites !== undefined) { + result = result && movie.favorite === !!filterFavorites; + } + if (filterUpcoming !== undefined) { + const releaseDate = new Date(movie.release_date); + result = + result && filterUpcoming ? releaseDate > today : releaseDate < today; + } + if (filterReleased !== undefined) { + const releaseDate = new Date(movie.release_date); + result = + result && filterReleased ? releaseDate < today : releaseDate > today; + } return result; }); @@ -69,8 +80,8 @@ export const MovieList: FC = ({ return (

-
- {heading && ( + {heading && ( +
{showFilters && ( = ({ )}

{heading}

- )} -
+
+ )} {filteredMovies.length === 0 && (

No movies found

)} diff --git a/src/components/organisms/Navbar/components/Search/index.tsx b/src/components/organisms/Navbar/components/Search/index.tsx index b66508c..6bc5fd2 100644 --- a/src/components/organisms/Navbar/components/Search/index.tsx +++ b/src/components/organisms/Navbar/components/Search/index.tsx @@ -41,14 +41,14 @@ export const Search = () => { return ( <> {isSearchOpen && ( -
+
{results && ( -
+

{total_results} movies found

)} diff --git a/src/components/organisms/Navbar/index.tsx b/src/components/organisms/Navbar/index.tsx index 0d6ef44..f1c6801 100644 --- a/src/components/organisms/Navbar/index.tsx +++ b/src/components/organisms/Navbar/index.tsx @@ -14,7 +14,7 @@ const links = [ export const Navbar = () => { return ( -
+
@@ -42,7 +42,7 @@ export const Navbar = () => {