angrybeanie-front-end/components/gallerycarousel.js

44 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2023-05-20 20:17:35 +10:00
import Image from "next/legacy/image";
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper';
2023-12-10 15:22:32 +11:00
import { Carousel, CarouselItem } from "react-bootstrap";
import { useState } from "react";
import Link from 'next/link'
2023-12-10 15:22:32 +11:00
const GalleryCarousel = ({galleryImages, basepath, gallery}) => {
const bootstrap = galleryImages.data;
const [index, setIndex] = useState(0);
2024-12-30 11:33:53 +11:00
//console.log(bootstrap)
2023-12-10 15:22:32 +11:00
const handleSelect = (selectedIndex, e) => {
setIndex(selectedIndex);
};
return(
<Carousel activeIndex={index} onSelect={handleSelect} fade>
{bootstrap.map((item =>
<Carousel.Item key={item.id} interval={4000}>
<Link href={"/gallery/" + gallery.attributes.Slug + "/" + item.attributes.Slug}><Image
src={basepath + item.attributes.Image.data.attributes.formats.large.url}
style={{
width: '100%',
height: 'auto',
}}
height={item.attributes.Image.data.attributes.formats.large.height}
width={item.attributes.Image.data.attributes.formats.large.width}
key={item.attributes.id}
//className="card-img-top"
alt={item.attributes.Title}
></Image></Link>
<Carousel.Caption >
2023-12-10 18:50:12 +11:00
<h3>{item.attributes.Title}</h3>
2023-12-10 15:22:32 +11:00
</Carousel.Caption>
</Carousel.Item>
)
)}
</Carousel>
)
}
export default GalleryCarousel