Merge commit 'b42aa6c960d7adfc435a7386ae0d983df1b5739c'

This commit is contained in:
Ardeman 2025-03-03 15:42:59 +08:00
commit acd3e36b31
2 changed files with 51 additions and 11 deletions

View File

@ -1,21 +1,38 @@
import useEmblaCarousel from 'embla-carousel-react'
import { Link } from 'react-router' import { Link } from 'react-router'
import { APP } from '~/configs/meta' import { BANNER } from '~/data/contents'
export const Banner = () => { export const Banner = () => {
const [emblaReference] = useEmblaCarousel({ loop: false })
return ( return (
<div className="min-h-[65px]"> <div className="">
<div className="relative"> <div className="relative">
<Link <div
to="/#" className="embla overflow-hidden"
className="mt-2 h-full py-2" ref={emblaReference}
> >
<img <div className="embla__container flex">
src={'/images/banner.png'} {BANNER.map(({ urlImage, alt, link }, index) => (
alt={APP.title} <div
className="h-[70px] w-[100%] content-center sm:h-full" key={index}
/> className="embla__slide max-h-[100px] min-h-[65px] w-full min-w-0 flex-none"
</Link> >
<Link
to={link}
className="mt-2 h-full py-2"
>
<img
src={urlImage}
alt={alt}
className="h-[70px] w-[100%] content-center sm:h-full"
/>
</Link>
</div>
))}
</div>
</div>
</div> </div>
</div> </div>
) )

View File

@ -1,4 +1,9 @@
import type { TNews } from '~/types/news' import type { TNews } from '~/types/news'
type TBanner = {
urlImage: string
alt: string
link: string
}
export const DUMMY_DESCRIPTION = 'Berita Terhangat hari ini' export const DUMMY_DESCRIPTION = 'Berita Terhangat hari ini'
@ -147,3 +152,21 @@ export const KAJIAN: TNews = {
}, },
], ],
} }
export const BANNER: TBanner[] = [
{
urlImage: '/images/banner.png',
alt: 'banner',
link: '/category/spotlight',
},
{
urlImage: 'https://placehold.co/1000x65.png',
alt: 'banner',
link: '/#',
},
{
urlImage: '/images/banner.png',
alt: 'banner',
link: '/#',
},
]