From f44c9c8e1a917e6aacef6692d19687aecfc75a1b Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 8 Jan 2025 08:27:50 -0700 Subject: [PATCH] implemented project slider buttons and slide indication. --- src/Projects.jsx | 51 +++++++++++++++++++++++++++++++++++++----------- src/main.css | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 11 deletions(-) diff --git a/src/Projects.jsx b/src/Projects.jsx index 41d3e88f..7bc92314 100644 --- a/src/Projects.jsx +++ b/src/Projects.jsx @@ -1,28 +1,57 @@ -import React from "react"; +import React, { useRef } from "react"; import ProjectCard from "./components/ProjectCard"; -import { Swiper, SwiperSlide } from "swiper/react"; -import { Mousewheel, Scrollbar, Pagination } from "swiper/modules"; +import { Swiper, SwiperSlide, useSwiper } from "swiper/react"; +import { Navigation, Scrollbar } from "swiper/modules"; import "swiper/css"; import "swiper/css/effect-cards"; import "swiper/css/scrollbar"; export default function Projects({ cardData }) { + const projectSwiperRef = useRef(null); + + const prevSlide = () => { + if (projectSwiperRef.current) { + projectSwiperRef.current.swiper.slidePrev(); + } + }; + + const nextSlide = () => { + if (projectSwiperRef.current) { + projectSwiperRef.current.swiper.slideNext(); + } + }; + return ( <>
-

Projects

+
+

Projects

+
+
+ + chevron_left + + Previous Project +
+ +
+ + chevron_right + + Next Project +
+
+
{cardData.map((c, index) => ( @@ -38,7 +67,7 @@ export default function Projects({ cardData }) { ))}
-
+ ); } diff --git a/src/main.css b/src/main.css index 442706c9..56a02179 100644 --- a/src/main.css +++ b/src/main.css @@ -319,6 +319,28 @@ p { grid-template-rows: 20% 80%; } +#projects-header-row { + display: flex; +} + +#projects-nav-buttons { + display: flex; + flex-direction: row; + align-items: center; + justify-content: right; + width: 100%; + margin-right: 5vw; +} + +.slider-nav-button { + margin: 2vw; + transition-duration: 500ms; +} + +#projects-header-row div span { + color: var(--accent-2); +} + #project-grid-container h1 { margin-left: 5vw; text-align: left; @@ -330,6 +352,26 @@ p { justify-content: center; } +/* Tooltip container */ +.tooltip .tooltip-text { + visibility: hidden; + width: 120px; + background-color: var(--dark-0); + color: var(--text); + text-align: center; + padding: 5px 0; + border-radius: 6px; + + /* Position the tooltip text - see examples below! */ + position: absolute; + z-index: 1; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip:hover .tooltip-text { + visibility: visible; +} + /**PROJECT CARDS**/ .project-card { display: grid;