From b4bebd0532c7dd150ce69fd0aab1ee758c005229 Mon Sep 17 00:00:00 2001 From: xomimishka Date: Mon, 26 May 2025 00:09:29 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B5=D0=BB=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=BB=D0=B0=D0=B9=D0=B4=D0=B5=D1=80=D0=B5=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 12 +- package.json | 3 +- .../LabBoard/LabBoard.module.scss | 214 ++++++++++++++---- .../CustomProjects/LabBoard/LabBoard.tsx | 142 ++++++------ 4 files changed, 257 insertions(+), 114 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef4af04..86cd3ac 100755 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "react-router": "^7.1.1", "react-router-dom": "^6.28.1", "react-router-hash-link": "^2.4.3", + "react-swipeable": "^7.0.2", "sass": "^1.85.1", "swiper": "^11.2.5", "wpapi": "^1.2.2", @@ -68,7 +69,7 @@ "i": "^0.3.7", "npm": "^11.2.0", "typescript": "^5.5.3", - "vite": "^5.3.1" + "vite": "^5.4.19" } }, "node_modules/@ampproject/remapping": { @@ -8038,6 +8039,15 @@ "react-router-dom": ">=4" } }, + "node_modules/react-swipeable": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-7.0.2.tgz", + "integrity": "sha512-v1Qx1l+aC2fdxKa9aKJiaU/ZxmJ5o98RMoFwUqAAzVWUcxgfHFXDDruCKXhw6zIYXm6V64JiHgP9f6mlME5l8w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.3 || ^17 || ^18 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", diff --git a/package.json b/package.json index 7528721..a6d0910 100755 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "react-router": "^7.1.1", "react-router-dom": "^6.28.1", "react-router-hash-link": "^2.4.3", + "react-swipeable": "^7.0.2", "sass": "^1.85.1", "swiper": "^11.2.5", "wpapi": "^1.2.2", @@ -70,6 +71,6 @@ "i": "^0.3.7", "npm": "^11.2.0", "typescript": "^5.5.3", - "vite": "^5.3.1" + "vite": "^5.4.19" } } diff --git a/src/pages/CustomProjects/LabBoard/LabBoard.module.scss b/src/pages/CustomProjects/LabBoard/LabBoard.module.scss index 76c8326..396d3c6 100644 --- a/src/pages/CustomProjects/LabBoard/LabBoard.module.scss +++ b/src/pages/CustomProjects/LabBoard/LabBoard.module.scss @@ -3,6 +3,7 @@ overflow: hidden; min-height: 100vh; padding: 0 10%; + margin: 0; margin-bottom: 64px; color: rgba(18, 18, 18, 1); @@ -71,15 +72,35 @@ display: none; } } + + @media (max-width: 768px) { + padding: 0 5%; + margin-bottom: 32px; + } } #padding { padding: 0 10%; + + @media (max-width: 768px) { + padding: 0 5%; + } +} + +#padding2 { + padding: 0 10%; + @media (max-width: 769px) { + padding: 0 2.5%; + } } #page_container { padding: 0 10%; + @media (max-width: 768px) { + padding: 0 5%; + } + h2 { font-size: 36px; } @@ -120,6 +141,7 @@ @media (max-width: 768px) { flex-direction: column; gap: 24px; + margin-bottom: 32px; } } @@ -168,6 +190,7 @@ @media (max-width: 768px) { flex-direction: column; gap: 24px; + margin-bottom: 32px; } } @@ -202,6 +225,7 @@ @media (max-width: 768px) { flex-direction: column; gap: 24px; + margin-bottom: 32px; } } @@ -278,15 +302,8 @@ .sliderNav { display: flex; gap: 16px; - - @media (max-width: 768px) { - order: 2; - justify-content: center; - width: 100%; - } } - .sliderButton { width: 40px; height: 40px; @@ -304,57 +321,166 @@ } } -// Карточка слайда -.sliderWrapper { - width: 100%; +.slideActive, +.slideNext { + background: #f5f5f7; + border-radius: 16px; display: flex; + align-items: center; justify-content: center; - margin-bottom: 64px; + transition: all 0.5s ease-in-out; + opacity: 1; + transform: scale(1); +} - @media (max-width: 768px) { - margin-bottom: 32px; - margin-top: 16px; +.slideActive { + flex: 2; + padding: 48px; + border: 2px solid #0867F4; + + .activeImage { + width: 100%; + height: 300px; + object-fit: contain; + } +} + +.slideNext { + flex: 1; + padding: 32px; + + .nextImage { + width: 100%; + max-height: 200px; + height: auto; + object-fit: contain; + } +} + +.slideActive.fade-out, +.slideNext.fade-out, +.fadeOut { + opacity: 0; + transform: scale(0.98); +} + +@media (max-width: 768px) { + + .slideActive, + .slideNext { + width: 100%; + flex: none; + } + + .slideNext { + display: none; + } + + .sliderNav { + display: none; + } + + .swiper-slide { + opacity: 1 !important; + transition: none !important; + height: 48vh !important; + + .slide-image { + height: 350px !important; + } + } + + .slideActive .activeImage { + height: 200px; // или auto, если хочешь, чтобы она заполняла контейнер + max-height: 60vh; // чтобы не вылезала за экран + width: 100%; + object-fit: contain; + } + + .swiper-slide { + height: auto; // либо установи нужную высоту, например: 60vh + } + + .slideActive { + padding: 16px; // уменьшить паддинги, чтобы картинка влезала лучше } } -.slideContent { - width: 100%; - background: #f5f5f7; - border-radius: 16px; - padding: 48px; +.swiper-slide { + opacity: 0.5; + transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; + height: 65vh; + + .slide-image { + height: 500px; + } +} + +.swiper-slide-active { + opacity: 1; + transform: scale(1); +} + +.swiper-slide-prev, +.swiper-slide-next { + opacity: 0.7; + transform: scale(0.9); + + @media (max-width: 768px) { + opacity: 1; + transform: none; + } +} + +.sliderWrapper { display: flex; - height: 352px; align-items: center; - justify-content: center; -} - - -.slideImage { - width: 80%; - height: auto; - object-fit: contain; -} - - -.swiperSlide { - flex-shrink: 0; + gap: 16px; width: 100%; + margin-bottom: 34px; - transition: all 0.3s ease; - transform: scale(0.8); - opacity: 0.6; + @media (max-width: 768px) { + .sliderNav { + display: none; + } + } +} + +.sliderContainer { + display: flex; + gap: 32px; + width: 100%; + margin-bottom: 32px; + + @media (max-width: 768px) { + flex: 1; + gap: 0; + + .slideNext { + display: none; + } + } +} + +.sliderButton2 { + width: 40px; + height: 40px; + border-radius: 50%; + background: #f5f5f7; + border: none; cursor: pointer; display: flex; + align-items: center; justify-content: center; -} + + img { + width: 16px; + height: 16px; + } - -.slideActive { - transform: scale(1); - opacity: 1; - border: 2px solid #0867F4; - border-radius: 16px; - z-index: 10; + @media (min-width: 769px) { + display: none; + } } \ No newline at end of file diff --git a/src/pages/CustomProjects/LabBoard/LabBoard.tsx b/src/pages/CustomProjects/LabBoard/LabBoard.tsx index 47ea98e..63fa003 100644 --- a/src/pages/CustomProjects/LabBoard/LabBoard.tsx +++ b/src/pages/CustomProjects/LabBoard/LabBoard.tsx @@ -8,12 +8,7 @@ import microcontroller_rear from "@/shared/assets/images/LabBoard/microcontrolle import Group_one from "@/shared/assets/images/LabBoard/Group_one.svg"; import Group_two from "@/shared/assets/images/LabBoard/Group_two.svg"; import Vector from "@/shared/assets/images/LabBoard/Vector.svg"; - -import { Swiper, SwiperSlide } from "swiper/react"; -import { Navigation, Pagination } from "swiper/modules"; -import "swiper/css"; -import "swiper/css/navigation"; -import "swiper/css/pagination"; +import { useSwipeable } from 'react-swipeable'; import ContactUs from "@/widgets/ContactUs"; @@ -72,6 +67,24 @@ function LabBoard() { { image: Group_two, title: "Slide 2", description1: "Текст для слайда 2", description2: "222" } ]; + const [fade, setFade] = useState(false); + + const nextSlide = () => { + setFade(true); + setTimeout(() => { + setCurrentSlide((prev) => (prev + 1) % slides.length); + setFade(false); + }, 200); + }; + + const prevSlide = () => { + setFade(true); + setTimeout(() => { + setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length); + setFade(false); + }, 200); + }; + return (
@@ -154,76 +167,69 @@ function LabBoard() {

Подробнее о микроконтроллерах

- -
- -
- setCurrentSlide(swiper.realIndex)} - className={styles.sliderContainer} - allowTouchMove={false} - breakpoints={{ - 0: { - slidesPerView: 1, - centeredSlides: false, - }, - 768: { - slidesPerView: 2, - centeredSlides: true, - } - }} - > - {slides.map((slide, index) => ( - -
- {slide.title} -
-
- ))} -
- -
-
-

- {slides[currentSlide]?.title} -

-
-

-

- {slides[currentSlide]?.description1} -
-

-

-

- {slides[currentSlide]?.description2} -
-

-
-
+
+ + +
+
+ {slides[currentSlide].title} +
+
+ {slides[(currentSlide +
+
+ + +
+ +
+

+ {slides[currentSlide]?.title} +

+
+

+

+ {slides[currentSlide]?.description1} +
+

+

+

+ {slides[currentSlide]?.description2} +
+

+
+
+