-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathimageCarousel.tsx
47 lines (44 loc) · 1.36 KB
/
imageCarousel.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"use client"
import "react-medium-image-zoom/dist/styles.css"
import NextImage from "next-image-export-optimizer"
import { StaticImageData } from "next/image"
import Slider from "react-slick"
import "slick-carousel/slick/slick.css"
import "slick-carousel/slick/slick-theme.css"
import { ComponentProps } from "react"
const settings: ComponentProps<typeof Slider> = {
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
initialSlide: 0,
adaptiveHeight: true,
}
interface Props {
images: StaticImageData[]
index: number
}
export const ImageCarousel = ({ images, index }: Props) => {
settings.initialSlide = index || 0
return (
<div className="z-[9999] fixed left-0 top-0 bg-[rgba(0,0,0,0.5)] h-screen w-screen flex justify-center">
<div className="w-screen max-w-[1504px]">
<Slider {...settings} className="rounded-2xl">
{images.map(image => (
<div className="w-max">
<div className="flex justify-center ">
<div className="max-w-max h-max flex justify-center w-full">
<img
key={image.src}
alt={"gallery image"}
className="h-full max-h-screen"
src={image.src}
/>
</div>
</div>
</div>
))}
</Slider>
</div>
</div>
)
}