2025-03-09 14:32:04 +08:00
|
|
|
import Autoplay from 'embla-carousel-autoplay'
|
2025-03-03 13:42:01 +07:00
|
|
|
import useEmblaCarousel from 'embla-carousel-react'
|
2025-02-20 01:37:35 +07:00
|
|
|
import { Link } from 'react-router'
|
|
|
|
|
|
2025-03-03 13:42:01 +07:00
|
|
|
import { BANNER } from '~/data/contents'
|
2025-02-20 01:37:35 +07:00
|
|
|
|
2025-02-23 20:41:19 +07:00
|
|
|
export const Banner = () => {
|
2025-03-09 14:32:04 +08:00
|
|
|
const [emblaReference] = useEmblaCarousel({ loop: true }, [Autoplay()])
|
2025-03-03 13:42:01 +07:00
|
|
|
|
2025-02-20 01:37:35 +07:00
|
|
|
return (
|
2025-03-03 13:42:01 +07:00
|
|
|
<div className="">
|
2025-02-20 01:37:35 +07:00
|
|
|
<div className="relative">
|
2025-03-03 13:42:01 +07:00
|
|
|
<div
|
|
|
|
|
className="embla overflow-hidden"
|
|
|
|
|
ref={emblaReference}
|
2025-02-20 01:37:35 +07:00
|
|
|
>
|
2025-03-03 13:42:01 +07:00
|
|
|
<div className="embla__container flex">
|
|
|
|
|
{BANNER.map(({ urlImage, alt, link }, index) => (
|
|
|
|
|
<div
|
|
|
|
|
key={index}
|
|
|
|
|
className="embla__slide max-h-[100px] min-h-[65px] w-full min-w-0 flex-none"
|
|
|
|
|
>
|
|
|
|
|
<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>
|
2025-02-20 01:37:35 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|