fix:home banner

This commit is contained in:
Rama Priyanto 2025-06-09 19:38:24 +07:00
parent a3538d1322
commit 3f86306bc1
1 changed files with 44 additions and 45 deletions

View File

@ -82,7 +82,7 @@ export default function HeaderNews() {
<div className="w-full"> <div className="w-full">
<div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto"> <div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto">
<div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto"> <div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto">
{banner?.length > 0 ? ( {hotNews?.length > 0 ? (
<Swiper <Swiper
centeredSlides={true} centeredSlides={true}
autoplay={{ autoplay={{
@ -222,7 +222,7 @@ export default function HeaderNews() {
</div> </div>
<div className="hidden lg:block w-full lg:w-[50%] h-[500px]"> <div className="hidden lg:block w-full lg:w-[50%] h-[500px]">
{banner?.length > 0 ? ( {hotNews?.length > 0 ? (
<Swiper <Swiper
centeredSlides={true} centeredSlides={true}
autoplay={{ autoplay={{
@ -249,49 +249,48 @@ export default function HeaderNews() {
); );
}} }}
> >
{banner?.lenth > 0 && {hotNews.map((newsItem: any, index: number) => (
banner.map((newsItem: any, index: number) => ( <SwiperSlide key={newsItem?.id} className="!w-full h-[50vh]">
<SwiperSlide key={newsItem?.id} className="!w-full h-[50vh]"> <Card
<Card isFooterBlurred
isFooterBlurred radius="lg"
radius="lg" className="border-none h-[50vh] lg:h-[500px] shadow-none"
className="border-none h-[50vh] lg:h-[500px] shadow-none" >
> <Image
<Image alt="headernews"
alt="headernews" src={
src={ newsItem?.thumbnailUrl == ""
newsItem?.thumbnailUrl == "" ? "/no-image.jpg"
? "/no-image.jpg" : newsItem?.thumbnailUrl
: newsItem?.thumbnailUrl }
} className="!w-full !h-[500px] !object-cover !rounded-none"
className="!w-full !h-[500px] !object-cover !rounded-none" />
/>
<CardFooter className="mb-1 max-h-[20vh] before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute before:rounded-xl rounded-large bottom-1 w-[calc(100%_-_8px)] shadow-small ml-1 z-10"> <CardFooter className="mb-1 max-h-[20vh] before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute before:rounded-xl rounded-large bottom-1 w-[calc(100%_-_8px)] shadow-small ml-1 z-10">
<div className="text-white"> <div className="text-white">
<Link <Link
href={`news/detail/${newsItem.id}-${newsItem?.slug}`} href={`news/detail/${newsItem.id}-${newsItem?.slug}`}
> >
<p className="text-left font-semibold text-lg lg:text-2xl"> <p className="text-left font-semibold text-lg lg:text-2xl">
{textEllipsis(newsItem.title, 40)} {textEllipsis(newsItem.title, 40)}
</p> </p>
</Link> </Link>
<div className="flex flex-row gap-1"> <div className="flex flex-row gap-1">
<p className="py-[2px] text-left text-sm"> <p className="py-[2px] text-left text-sm">
{convertDateFormat(newsItem.createdAt)} WIB {convertDateFormat(newsItem.createdAt)} WIB
</p> </p>
<p className="flex items-center gap-1 text-sm"> <p className="flex items-center gap-1 text-sm">
<EyeIcon /> <EyeIcon />
{newsItem.viewCount === null {newsItem.viewCount === null
? 0 ? 0
: newsItem.viewCount} : newsItem.viewCount}
</p> </p>
</div>
</div> </div>
</CardFooter> </div>
</Card> </CardFooter>
</SwiperSlide> </Card>
))} </SwiperSlide>
))}
</Swiper> </Swiper>
) : ( ) : (
<Skeleton className="rounded-lg"> <Skeleton className="rounded-lg">
@ -322,8 +321,8 @@ export default function HeaderNews() {
</a> </a>
</div> </div>
<ScrollShadow hideScrollBar className="h-[39vh] lg:h-[400px]"> <ScrollShadow hideScrollBar className="h-[39vh] lg:h-[400px]">
{article.length > 0 ? ( {article?.length > 0 ? (
article.map((list: any, index: number) => ( article?.map((list: any, index: number) => (
<div <div
key={list?.id} key={list?.id}
className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md" className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md"