From e48ad4e5f932a56190ff6f083df74e07bfd1ffeb Mon Sep 17 00:00:00 2001 From: Rama Priyanto Date: Thu, 24 Apr 2025 17:30:04 +0700 Subject: [PATCH] temporary jumbotron --- app/(admin)/admin/advertise/page.tsx | 2 +- components/landing/banner-new.tsx | 39 +++++++++++++++++++++------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/(admin)/admin/advertise/page.tsx b/app/(admin)/admin/advertise/page.tsx index c9fe8c3..20b6eab 100644 --- a/app/(admin)/admin/advertise/page.tsx +++ b/app/(admin)/admin/advertise/page.tsx @@ -104,7 +104,6 @@ export default function AdvertisePage() { } close(); - setRefresh(!refresh); MySwal.fire({ title: "Sukses", icon: "success", @@ -112,6 +111,7 @@ export default function AdvertisePage() { confirmButtonText: "OK", }).then((result) => { if (result.isConfirmed) { + setRefresh(!refresh); } }); }; diff --git a/components/landing/banner-new.tsx b/components/landing/banner-new.tsx index 9602837..7e536f3 100644 --- a/components/landing/banner-new.tsx +++ b/components/landing/banner-new.tsx @@ -53,6 +53,7 @@ interface Jumbotron { title: string; description: string; redirectLink: string; + contentFileUrl: string; } export default function BannerHumasNew() { @@ -92,7 +93,7 @@ export default function BannerHumasNew() { }, []); const initFetch = async () => { - const req = { page: 1, limit: 5, placement: "jumbotron" }; + const req = { page: 1, limit: 5, placement: "jumbotron", isPublish: true }; const res = await getAdvertise(req); setJumbotronList(res?.data?.data); }; @@ -224,21 +225,39 @@ export default function BannerHumasNew() { className="flex w-full h-[45vh] lg:h-[93vh] transition-transform duration-700 ease-in-out" style={{ transform: `translateX(-${currentIndex * 100}%)` }} > - {jumbotronList?.map((img, index) => ( - + {jumbotronList?.length > 0 ? ( + jumbotronList?.map((img, index) => ( + + {`humasbanner-${index}`} + + )) + ) : ( + {`humasbanner-${index}`} - ))} + )}