From fd1240252d4d940d339b0dd07125b68517d93f11 Mon Sep 17 00:00:00 2001 From: Norbert Maciaszek Date: Mon, 18 Aug 2025 15:27:28 +0200 Subject: [PATCH] feat: implement responsive container utility and enhance layout styles across components; update Carousel and Gallery for improved structure and consistency --- src/app/aktor/[id]/page.tsx | 36 ++- src/app/film/[id]/page.tsx | 4 +- src/app/globals.css | 42 ++- src/app/layout.tsx | 4 +- src/app/odkrywaj/page.tsx | 86 ++---- src/components/atoms/Button/index.tsx | 7 +- .../atoms/MovieCard/layouts/AuroraLayout.tsx | 2 +- src/components/molecules/ActorHero/index.tsx | 292 +++++++++--------- src/components/molecules/Carousel/index.tsx | 16 +- src/components/molecules/Gallery/index.tsx | 120 ++++--- src/components/molecules/HeroMovie/index.tsx | 6 +- src/components/molecules/MovieCast/index.tsx | 6 +- src/components/molecules/MovieList/index.tsx | 6 +- .../molecules/RecommendedMovies/index.tsx | 26 +- .../molecules/SimilarMovies/index.tsx | 2 +- .../Navbar/components/Search/index.tsx | 17 +- src/components/organisms/Navbar/index.tsx | 26 +- 17 files changed, 353 insertions(+), 345 deletions(-) diff --git a/src/app/aktor/[id]/page.tsx b/src/app/aktor/[id]/page.tsx index 96c5d03..8b93b43 100644 --- a/src/app/aktor/[id]/page.tsx +++ b/src/app/aktor/[id]/page.tsx @@ -16,22 +16,30 @@ export default async function Page({ const personDetails = await TMDB.getPersonDetails(actorId); return ( -
+
-
- } - colors="purple" - > - {personDetails.movie_credits.cast.map((movie) => { - const convertedMovie = convertToMovie(movie); - if (!convertedMovie) return null; - return ; - })} - -
+
+
+ } + colors="purple" + > + {personDetails.movie_credits.cast + .sort( + (a, b) => + new Date(b.release_date).getTime() - + new Date(a.release_date).getTime() + ) + .map((movie) => { + const convertedMovie = convertToMovie(movie); + if (!convertedMovie) return null; + return ; + })} + +
+
); } diff --git a/src/app/film/[id]/page.tsx b/src/app/film/[id]/page.tsx index 26ef2f1..9532e7b 100644 --- a/src/app/film/[id]/page.tsx +++ b/src/app/film/[id]/page.tsx @@ -12,10 +12,10 @@ export default async function Page({ const movieDetails = await TMDB.getMovieDetails(movieId); return ( -
+ <> -
+ ); } diff --git a/src/app/globals.css b/src/app/globals.css index 6a9418d..0a80c26 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -46,18 +46,30 @@ @custom-variant hover-any (&:hover); +@utility container { + margin: 0 auto; + padding: 0 15px; + width: 100%; + max-width: 100%; + + @variant sm { + max-width: 640px; + } + + @variant lg { + max-width: 860px; + } + + @variant xl { + max-width: 1280px; + } +} + @layer base { body { @apply bg-hippie-blue-950 text-text; } - .container { - width: 100%; - max-width: 1200px; - margin: 0 auto; - padding: 0 15px; - } - .container-fluid { width: 100%; max-width: 100%; @@ -71,6 +83,22 @@ margin: 0 -15px; } + .blocks { + margin: 32px 0; + + @variant lg { + margin: 64px 0; + } + } + + .blockp { + padding: 32px 0; + + @variant lg { + padding: 64px 0; + } + } + a { @apply transition-colors; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 29e3aff..6a80a26 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -34,9 +34,7 @@ export default async function RootLayout({ -
- {children} -
+
{children}
diff --git a/src/app/odkrywaj/page.tsx b/src/app/odkrywaj/page.tsx index 5adacf1..cdd5494 100644 --- a/src/app/odkrywaj/page.tsx +++ b/src/app/odkrywaj/page.tsx @@ -47,63 +47,41 @@ export default async function Home() { <> -
-
- }> - {nowPlayingMovies.map((movie) => ( - - ))} - -
+
+ }> + {nowPlayingMovies.map((movie) => ( + + ))} + +
-
- } - colors="blue" - > - {upcomingMovies.map((movie) => ( - - ))} - -
+
+ } + colors="blue" + > + {upcomingMovies.map((movie) => ( + + ))} + +
-
- } colors="red"> - {popularMovies.map((movie) => ( - - ))} - -
+
+ } colors="red"> + {popularMovies.map((movie) => ( + + ))} + +
-
- } colors="green"> - {trendingMovies.map((movie) => ( - - ))} - -
-
+
+ } colors="green"> + {trendingMovies.map((movie) => ( + + ))} + +

Ostatnia aktualizacja: {lastModified}

diff --git a/src/components/atoms/Button/index.tsx b/src/components/atoms/Button/index.tsx index 4721f45..59b44de 100644 --- a/src/components/atoms/Button/index.tsx +++ b/src/components/atoms/Button/index.tsx @@ -7,7 +7,7 @@ type Props = { children: React.ReactNode; className?: string; theme?: Theme; - size?: "small" | "medium" | "large"; + size?: "small" | "medium" | "large" | "icon"; onClick?: () => void; href?: string; gradient?: { @@ -31,7 +31,7 @@ export const Button: FC = ({ return ( *]:w-5 [&>*]:h-5", }; const colors = { @@ -57,7 +58,7 @@ const colors = { to: "to-pink-600 hover:to-pink-500", }, glass: { - from: "from-white/15 via-white/8 to-white/12", + from: "from-white/15 via-white/8 to-white/12 border border-white/20", to: "to-white/15 hover:to-white/10", }, rose: { diff --git a/src/components/atoms/MovieCard/layouts/AuroraLayout.tsx b/src/components/atoms/MovieCard/layouts/AuroraLayout.tsx index b6613b5..98d3f22 100644 --- a/src/components/atoms/MovieCard/layouts/AuroraLayout.tsx +++ b/src/components/atoms/MovieCard/layouts/AuroraLayout.tsx @@ -48,7 +48,7 @@ export const AuroraLayout: FC = ({ : "from-red-400 to-pink-400"; return ( -
+
{/* Aurora background effect */}
diff --git a/src/components/molecules/ActorHero/index.tsx b/src/components/molecules/ActorHero/index.tsx index 51df2d6..80bae35 100644 --- a/src/components/molecules/ActorHero/index.tsx +++ b/src/components/molecules/ActorHero/index.tsx @@ -55,7 +55,7 @@ export const ActorHero: FC = ({ personDetails }) => { }; return ( -
+
{/* Navigation */}
@@ -63,161 +63,157 @@ export const ActorHero: FC = ({ personDetails }) => {
{/* Main content */} -
-
-
- {/* Profile photo */} -
-
- {personDetails.name} -
-
+
+
+ {/* Profile photo */} +
+
+ {personDetails.name} +
+
- {/* Actor details */} -
-
- {/* Name and known for */} -
-

- {personDetails.name} -

- {personDetails.birthday && ( - - ( - {calculateAge( - personDetails.birthday, - personDetails.deathday - )}{" "} - lat - {personDetails.deathday && " w chwili śmierci"}) - - )} - -
-
- - - {personDetails.known_for_department} - -
- -
- - - {Math.round(personDetails.popularity)} popularność - -
-
- - {/* Also known as */} - {personDetails.also_known_as.length > 0 && ( -
-

- Znany również jako:{" "} - {personDetails.also_known_as.slice(0, 3).join(", ")} -

-
- )} -
- - {/* Personal info */} -
- {/* Gender */} -
- Płeć: - {getGenderText(personDetails.gender)} -
- - {/* Birthday */} - {personDetails.birthday && ( -
- -
- {formatDate(personDetails.birthday)} -
-
- )} - - {/* Deathday */} - {personDetails.deathday && ( -
- -
- Data śmierci: - {formatDate(personDetails.deathday)} -
-
- )} - - {/* Place of birth */} - {personDetails.place_of_birth && ( -
- - {personDetails.place_of_birth} -
- )} -
- - {/* Biography */} - {personDetails.biography && ( -
-

- Biografia -

-
- {personDetails.biography - .split("\n\n") - .map((paragraph, index) => ( -

{paragraph}

- ))} -
-
+ {/* Actor details */} +
+
+ {/* Name and known for */} +
+

+ {personDetails.name} +

+ {personDetails.birthday && ( + + ( + {calculateAge( + personDetails.birthday, + personDetails.deathday + )}{" "} + lat + {personDetails.deathday && " w chwili śmierci"}) + )} - {/* External links */} - {personDetails.external_ids && ( -
-

- Linki -

-
- {Object.entries(personDetails.external_ids).map( - ([key, value]) => { - if (!(key in externalIdsMap) || !value) { - return null; - } +
+
+ + + {personDetails.known_for_department} + +
- const { label, icon, url } = - externalIdsMap[ - key as keyof typeof externalIdsMap - ]; - return ( - - {icon} - {label} - - ); - } - )} -
+
+ + + {Math.round(personDetails.popularity)} popularność + +
+
+ + {/* Also known as */} + {personDetails.also_known_as.length > 0 && ( +
+

+ Znany również jako:{" "} + {personDetails.also_known_as.slice(0, 3).join(", ")} +

)}
+ + {/* Personal info */} +
+ {/* Gender */} +
+ Płeć: + {getGenderText(personDetails.gender)} +
+ + {/* Birthday */} + {personDetails.birthday && ( +
+ +
+ {formatDate(personDetails.birthday)} +
+
+ )} + + {/* Deathday */} + {personDetails.deathday && ( +
+ +
+ Data śmierci: + {formatDate(personDetails.deathday)} +
+
+ )} + + {/* Place of birth */} + {personDetails.place_of_birth && ( +
+ + {personDetails.place_of_birth} +
+ )} +
+ + {/* Biography */} + {personDetails.biography && ( +
+

+ Biografia +

+
+ {personDetails.biography + .split("\n\n") + .map((paragraph, index) => ( +

{paragraph}

+ ))} +
+
+ )} + + {/* External links */} + {personDetails.external_ids && ( +
+

+ Linki +

+
+ {Object.entries(personDetails.external_ids).map( + ([key, value]) => { + if (!(key in externalIdsMap) || !value) { + return null; + } + + const { label, icon, url } = + externalIdsMap[key as keyof typeof externalIdsMap]; + return ( + + {icon} + {label} + + ); + } + )} +
+
+ )}
diff --git a/src/components/molecules/Carousel/index.tsx b/src/components/molecules/Carousel/index.tsx index bbc2fb3..f472101 100644 --- a/src/components/molecules/Carousel/index.tsx +++ b/src/components/molecules/Carousel/index.tsx @@ -15,6 +15,7 @@ type Props = { heading?: string; icon?: ReactNode; colors?: keyof typeof colorsMap; + fluid?: boolean; }; export const Carousel: FC = ({ @@ -24,6 +25,7 @@ export const Carousel: FC = ({ heading, icon, colors = "yellow", + fluid = false, }) => { const { itemsPerView = 4, @@ -66,17 +68,19 @@ export const Carousel: FC = ({ ); return ( -
-
+
+
{heading && (
{icon && ( -
+
{icon}
)}

{heading}

@@ -84,7 +88,7 @@ export const Carousel: FC = ({ )} {totalPages > 1 && ( -
+
- ); - })} -
- )} - - {/* Image grid */} -
div]:contents`}> - - {currentImages.slice(0, limit).map((image, index) => ( - - - - ))} - +

+ {heading} +

- {limit < currentImages.length && ( -
- + ); + })} +
+ )} + + {/* Image grid */} +
div]:contents`}> + + {currentImages.slice(0, limit).map((image, index) => ( + - Pokaż wszystkie ({currentImages.length - limit}) - -
- )} + + + ))} +
+ {limit < currentImages.length && ( +
+ +
+ )}
); diff --git a/src/components/molecules/HeroMovie/index.tsx b/src/components/molecules/HeroMovie/index.tsx index 61b6930..47f32be 100644 --- a/src/components/molecules/HeroMovie/index.tsx +++ b/src/components/molecules/HeroMovie/index.tsx @@ -75,7 +75,7 @@ export const HeroMovie: FC = ({ movieDetails }) => { }; return ( -
+
{/* Navigation */}
@@ -83,8 +83,8 @@ export const HeroMovie: FC = ({ movieDetails }) => {
{/* Main content */} -
-
+
+
{/* Movie poster */}
diff --git a/src/components/molecules/MovieCast/index.tsx b/src/components/molecules/MovieCast/index.tsx index 4f06541..75a46b0 100644 --- a/src/components/molecules/MovieCast/index.tsx +++ b/src/components/molecules/MovieCast/index.tsx @@ -23,14 +23,14 @@ export const MovieCast: FC = ({ movieDetails }) => { }).format(amount); return ( -
-
+
+
{/* Cast */} {mainCast.length > 0 && (

Obsada

-
+
{mainCast.map((actor) => ( = ({ } return ( -
-
+
+
{heading && (
@@ -103,7 +103,7 @@ export const MovieList: FC = ({ )} {filteredMovies.length > 0 && (
{sortedMovies.map((movie) => ( diff --git a/src/components/molecules/RecommendedMovies/index.tsx b/src/components/molecules/RecommendedMovies/index.tsx index dc05985..29ae02b 100644 --- a/src/components/molecules/RecommendedMovies/index.tsx +++ b/src/components/molecules/RecommendedMovies/index.tsx @@ -13,15 +13,20 @@ export const RecommendedMovies: FC = ({ movies }) => { if (!movies.results.length) return null; return ( -
-
-
- } - colors="yellow" - > - {movies.results.map((movie) => ( +
+
+ } + colors="yellow" + > + {movies.results + .sort( + (a, b) => + new Date(b.release_date).getTime() - + new Date(a.release_date).getTime() + ) + .map((movie) => ( = ({ movies }) => { favorite={false} /> ))} - -
+
); diff --git a/src/components/molecules/SimilarMovies/index.tsx b/src/components/molecules/SimilarMovies/index.tsx index 747e0c1..0aedc77 100644 --- a/src/components/molecules/SimilarMovies/index.tsx +++ b/src/components/molecules/SimilarMovies/index.tsx @@ -32,7 +32,7 @@ export const SimilarMovies: FC = ({ movies }) => { return (
-
+

Podobne filmy diff --git a/src/components/organisms/Navbar/components/Search/index.tsx b/src/components/organisms/Navbar/components/Search/index.tsx index 543fd10..07eef44 100644 --- a/src/components/organisms/Navbar/components/Search/index.tsx +++ b/src/components/organisms/Navbar/components/Search/index.tsx @@ -49,16 +49,12 @@ export const Search = () => { return ( <> {isSearchOpen && ( @@ -71,14 +67,11 @@ export const Search = () => { {/* Close button */}
diff --git a/src/components/organisms/Navbar/index.tsx b/src/components/organisms/Navbar/index.tsx index f9cb57a..d4b0de8 100644 --- a/src/components/organisms/Navbar/index.tsx +++ b/src/components/organisms/Navbar/index.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react"; import { HiMenuAlt3, HiX, HiSparkles } from "react-icons/hi"; import { Search } from "./components/Search"; import { usePathname } from "next/navigation"; +import { Button } from "@/components/atoms/Button"; const links = [ { @@ -33,7 +34,7 @@ export const Navbar = () => { return ( <> {/* Main Navbar */} -
+
{/* Aurora background effect */}
@@ -43,7 +44,7 @@ export const Navbar = () => {
-
+
{/* Logo */} { {/* Mobile Menu Button */} - + {isMobileMenuOpen ? ( + + ) : ( + + )} +