From 3865de1c56ddfe55ccc2903c2ad4abffda559358 Mon Sep 17 00:00:00 2001 From: Norbert Maciaszek Date: Sat, 16 Aug 2025 13:50:46 +0200 Subject: [PATCH] Refactor MovieCard component to introduce a new "minimal" layout option: update layout prop to support "minimal" design, modify default layout to "minimal", and enhance rendering logic for improved user experience across movie sections. --- src/app/odkrywaj/page.tsx | 8 +- src/components/atoms/MovieCard/index.tsx | 113 ++++++++++++++++++++++- 2 files changed, 115 insertions(+), 6 deletions(-) diff --git a/src/app/odkrywaj/page.tsx b/src/app/odkrywaj/page.tsx index e03f475..75ceb7f 100644 --- a/src/app/odkrywaj/page.tsx +++ b/src/app/odkrywaj/page.tsx @@ -45,7 +45,7 @@ export default async function Home() {

Teraz w kinach

{nowPlayingMovies.map((movie) => ( - + ))} @@ -56,7 +56,7 @@ export default async function Home() { {upcomingMovies.map((movie) => ( - + ))} @@ -67,7 +67,7 @@ export default async function Home() { {popularMovies.map((movie) => ( - + ))} @@ -76,7 +76,7 @@ export default async function Home() {

Trendy dnia

{trendingMovies.map((movie) => ( - + ))} diff --git a/src/components/atoms/MovieCard/index.tsx b/src/components/atoms/MovieCard/index.tsx index 90757dd..8da3010 100644 --- a/src/components/atoms/MovieCard/index.tsx +++ b/src/components/atoms/MovieCard/index.tsx @@ -11,7 +11,7 @@ import { FaFire } from "react-icons/fa"; import { RiCalendarCheckLine, RiCalendarScheduleLine } from "react-icons/ri"; type Props = Movie & { - layout?: "default" | "zeus"; + layout?: "default" | "zeus" | "minimal"; showDayCounter?: boolean; simpleToggle?: boolean; }; @@ -20,7 +20,7 @@ const buttonClass = "p-4 text-sm transition-colors cursor-pointer text-center group/toggle"; export const MovieCard: FC = ({ - layout = "default", + layout = "minimal", showDayCounter = true, simpleToggle = false, ...movie @@ -75,6 +75,115 @@ export const MovieCard: FC = ({ ) ); + // Minimal modern theme. + if (layout === "minimal") { + return ( +
+
+ {title} + + {/* Rating badge */} + {!!vote_average && ( +
+ + ★ {vote_average.toFixed(1)} + +
+ )} + + {/* Action overlay */} +
+ {!alreadyInStore ? ( + + ) : ( +
+ {isReleased && ( + + )} + + +
+ )} +
+
+ + {/* Content section */} +
+
+

+ {title} +

+
+ +
+
+ +
+ + {releaseDate.toLocaleDateString("pl-PL", { + day: "numeric", + month: "long", + year: "numeric", + })} + + {alreadyInStore && ( +
+ {seen && ( +
+ )} + {favorite && ( +
+ )} +
+ )} +
+
+
+ ); + } + if (layout === "zeus") { return (