From ef7cfccab8acbe6e45e446447bc32a525d2ff142 Mon Sep 17 00:00:00 2001 From: James Purser Date: Sun, 10 Dec 2023 15:22:32 +1100 Subject: [PATCH] Added basic carousel to gallery page --- components/css/styles.css | 10 +++++- components/gallerycarousel.js | 66 +++++++++++++++++++++-------------- pages/gallery/[gallery].js | 4 ++- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/components/css/styles.css b/components/css/styles.css index 6f9ac76..ccc4762 100755 --- a/components/css/styles.css +++ b/components/css/styles.css @@ -89,7 +89,7 @@ } .show_block{ - *display: inline; + display: inline; zoom: 1; height: 100%; padding: 5px; @@ -306,4 +306,12 @@ table td { font-size: 1em; + } + + .carousel { + height: 100% + } + + .carousel-item { + display: block } \ No newline at end of file diff --git a/components/gallerycarousel.js b/components/gallerycarousel.js index abbce7c..e47e633 100755 --- a/components/gallerycarousel.js +++ b/components/gallerycarousel.js @@ -1,33 +1,45 @@ import Image from "next/legacy/image"; import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper'; -import { Swiper, SwiperSlide } from 'swiper/react'; -import 'swiper/css'; -import 'swiper/css/navigation'; -import 'swiper/css/pagination'; -import 'swiper/css/scrollbar'; +import { Carousel, CarouselItem } from "react-bootstrap"; +import { useState } from "react"; +import Link from 'next/link' -const GalleryCarousel = ({galleryImages, basepath}) => { - console.log(galleryImages.data[0]) - return( - console.log('slide change')} - onSwiper={(swiper) => console.log(swiper)} - scrollbar={{ draggable: true }} - > - {galleryImages.data.map(item => ( - - {item.attributes.Title} - - ))} - - ) +const GalleryCarousel = ({galleryImages, basepath, gallery}) => { + const bootstrap = galleryImages.data; + const [index, setIndex] = useState(0); + + console.log(bootstrap) + + const handleSelect = (selectedIndex, e) => { + setIndex(selectedIndex); + }; + + return( + + {bootstrap.map((item => + + {item.attributes.Title} + +

{item.title}

+

{item.body}

+
+
+ ) + )} + +
+ ) } export default GalleryCarousel \ No newline at end of file diff --git a/pages/gallery/[gallery].js b/pages/gallery/[gallery].js index fb00de2..0f12e02 100644 --- a/pages/gallery/[gallery].js +++ b/pages/gallery/[gallery].js @@ -5,6 +5,7 @@ import { getGallery, getGalleryImages } from "../../data/external/cms.js" import GalleryPager from "../../components/gallerypager.js" import Head from 'next/head' import config from "../../data/internal/config.js" +import GalleryCarousel from "../../components/gallerycarousel.js" export async function getServerSideProps(context) { @@ -47,7 +48,8 @@ const Gallery = ({pagedata, gallery, galleryImages, serverRuntimeConfig, og_imag

{gallery.attributes.Title}

- + + ) }