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(); close();
setRefresh(!refresh);
MySwal.fire({ MySwal.fire({
title: "Sukses", title: "Sukses",
icon: "success", icon: "success",
@ -112,6 +111,7 @@ export default function AdvertisePage() {
confirmButtonText: "OK", confirmButtonText: "OK",
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
setRefresh(!refresh);
} }
}); });
}; };

View File

@ -53,6 +53,7 @@ interface Jumbotron {
title: string; title: string;
description: string; description: string;
redirectLink: string; redirectLink: string;
contentFileUrl: string;
} }
export default function BannerHumasNew() { export default function BannerHumasNew() {
@ -92,7 +93,7 @@ export default function BannerHumasNew() {
}, []); }, []);
const initFetch = async () => { 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); const res = await getAdvertise(req);
setJumbotronList(res?.data?.data); 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" className="flex w-full h-[45vh] lg:h-[93vh] transition-transform duration-700 ease-in-out"
style={{ transform: `translateX(-${currentIndex * 100}%)` }} style={{ transform: `translateX(-${currentIndex * 100}%)` }}
> >
{jumbotronList?.map((img, index) => ( {jumbotronList?.length > 0 ? (
<Link jumbotronList?.map((img, index) => (
href={img?.redirectLink} <Link
key={img?.id} href={img?.redirectLink}
className="w-full shrink-0" key={img?.id}
> className="w-full shrink-0"
>
<Image
// 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 <Image
src={images[index % 4]} src={images[0]}
alt={`humasbanner-${index}`} alt={`humasbanner-1`}
width={1960} width={1960}
height={1080} height={1080}
className="w-screen h-[45vh] lg:h-[93vh] object-cover object-center opacity-[25] dark:opacity-70 rounded-none" className="w-screen h-[45vh] lg:h-[93vh] object-cover object-center opacity-[25] dark:opacity-70 rounded-none"
/> />
</Link> </Link>
))} )}
</div> </div>
<div className="absolute inset-0 bg-black bg-opacity-40 pointer-events-none" /> <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%]"> <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%]">