import React, { useRef } from "react"; import ProjectCard from "./components/ProjectCard"; import { Swiper, SwiperSlide } from "swiper/react"; import { Scrollbar } from "swiper/modules"; import "swiper/css"; import "swiper/css/effect-cards"; import "swiper/css/scrollbar"; /* * The Projects page or "slide". Implements swiperjs (see documentation at https://swiperjs.com/) to create a nested * slider/swiper inside of the root VerticalSlider. This nested slider is horizontal, and displays Project Cards * (see /components/ProjectCard.jsx), generated for each element of the parameter cardData. * * Managed by /App.jsx. * Data by /main.jsx. * * @param cardData json[], each object contains the following: title, descriptionA, featureList, image, url * * TODO: Cursor icon when hover on the slide buttons should be a pointer, not highlighter. */ const Projects = ({ cardData }) => { // Reference the nested slider instead of the root slider. const projectSwiperRef = useRef(null); const prevSlide = () => { if (projectSwiperRef.current) { projectSwiperRef.current.swiper.slidePrev(); } }; const nextSlide = () => { if (projectSwiperRef.current) { projectSwiperRef.current.swiper.slideNext(); } }; return ( <>