temporary jumbotron

This commit is contained in:
Rama Priyanto 2025-04-24 17:30:04 +07:00
parent 3a9b625804
commit e48ad4e5f9
2 changed files with 30 additions and 11 deletions

View File

@ -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);
}
});
};

View File

@ -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) => (
<Link
href={img?.redirectLink}
key={img?.id}
className="w-full shrink-0"
>
<Image
src={images[index % 4]}
// src={images[index % 4]}
src={
img?.contentFileUrl == ""
? "/no-image.jpg"
: img?.contentFileUrl
}
unoptimized
alt={`humasbanner-${index}`}
width={1960}
height={1080}
className="w-screen h-[45vh] lg:h-[93vh] object-cover object-center opacity-[25] dark:opacity-70 rounded-none"
/>
</Link>
))}
))
) : (
<Link href="/" key="home" className="w-full shrink-0">
<Image
src={images[0]}
alt={`humasbanner-1`}
width={1960}
height={1080}
className="w-screen h-[45vh] lg:h-[93vh] object-cover object-center opacity-[25] dark:opacity-70 rounded-none"
/>
</Link>
)}
</div>
<div className="absolute inset-0 bg-black bg-opacity-40 pointer-events-none" />
<div className="absolute z-50 lg:mt-[50px] top-48 lg:top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center w-full lg:w-[75%]">