"use client"; import Image from "next/image"; import { Button, Card, CardFooter, CircularProgress, ScrollShadow, } from "@heroui/react"; import { ChevronLeftIcon, ChevronRightIcon, EyeIcon } from "../icons"; import { Swiper, SwiperSlide, useSwiper } from "swiper/react"; import "swiper/css"; import "swiper/css/navigation"; import Link from "next/link"; import { Autoplay, Pagination, Navigation, Controller } from "swiper/modules"; import { useEffect, useState } from "react"; import { getAdvertise } from "@/service/advertisement"; const datas = [ { id: 1, src: "/sample-banner.png" }, { id: 2, src: "/sample-banner-2.png" }, { id: 2, src: "/sample-banner-3.jpg" }, ]; interface Jumbotron { id: number; title: string; description: string; redirectLink: string; } export default function AddsCarousel() { const [jumbotronList, setJumbotronList] = useState([]); useEffect(() => { initFetch(); }, []); const initFetch = async () => { const req = { page: 1, limit: 5, placement: "banner" }; const res = await getAdvertise(req); setJumbotronList(res?.data?.data); }; return (
{jumbotronList ? ( { swiper.navigation.nextEl?.classList.add( "bg-white/70", "!text-black", "rounded-full", "!w-[40px]", "!h-[40px]" ); swiper.navigation.prevEl?.classList.add( "bg-white/70", "!text-black", "rounded-full", "!w-[40px]", "!h-[40px]" ); }} > {jumbotronList?.map((newsItem, index) => ( headernews ))} ) : ( )}
); }