From 72f13c7c2e02c4e4e86e1e159056c30279597617 Mon Sep 17 00:00:00 2001 From: Rafi Arrafif Date: Wed, 25 Mar 2026 19:44:54 +0700 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20restructure=20?= =?UTF-8?q?hero=20swiper=20to=20be=20media-specific?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/sections/Hero/components/Swiper.tsx | 122 +++++++----------- 1 file changed, 47 insertions(+), 75 deletions(-) diff --git a/features/home/sections/Hero/components/Swiper.tsx b/features/home/sections/Hero/components/Swiper.tsx index 82239d8..60f11c2 100644 --- a/features/home/sections/Hero/components/Swiper.tsx +++ b/features/home/sections/Hero/components/Swiper.tsx @@ -5,19 +5,19 @@ import { Button } from "@/shared/libs/shadcn/ui/button"; import { useRouter } from "next/navigation"; import { Autoplay, Navigation, Pagination } from "swiper/modules"; import { Swiper, SwiperSlide } from "swiper/react"; +import { Icon } from "@iconify/react"; export interface HeroSwiperProps { data: { id: string; - isClickable: boolean; title: string; - tags: string[]; - description: string; - buttonContent: string; - buttonLink: string; + slug: string; imageUrl: string; - startDate: string; - endDate: string; + synopsis: string; + genres: { + slug: string; + name: string; + }[]; }[]; } @@ -34,82 +34,54 @@ const HeroSwiper = (props: HeroSwiperProps) => { autoplay={{ delay: 5000, disableOnInteraction: false }} modules={[Autoplay, Pagination, Navigation]} > - {props.data.map((slide) => - slide.imageUrl ? ( - // Slide with image background - - {slide.title} - {slide.title && slide.description && ( -
-

- {slide.title} -

-
- {slide.tags.map((tag) => ( - - {tag} - - ))} -
-

- {slide.description} -

- {slide.isClickable && ( - - )} -
- )} -
- ) : ( - // Fallback for slides without image - ( + + {slide.title} +

{slide.title}

-
- {slide.tags.map((tag) => ( - - {tag} +
+ {slide.genres.map((genre) => ( + + {genre.name} ))}
-

- {slide.description} +

+ {slide.synopsis}

- {slide.isClickable && ( - - )} - - ), - )} + +
+ + ))}
);