diff --git a/index.html b/index.html index bf9ef1c..4885490 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ - Завод + СКБ "Компьютерное инновационное творчество" diff --git a/src/app/Layout/Root.tsx b/src/app/Layout/Root.tsx index 42ce703..87ad5f3 100644 --- a/src/app/Layout/Root.tsx +++ b/src/app/Layout/Root.tsx @@ -60,14 +60,28 @@ function Root() { }; }, [hasScrolled]); - // Ускоренный плавный скролл вверх + // скролл вверх const scrollToTop = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", - }); + const duration = 900; + const start = window.scrollY; + const startTime = performance.now(); + + const animateScroll = (currentTime: number) => { + const timeElapsed = currentTime - startTime; + const progress = Math.min(timeElapsed / duration, 1); + const ease = 1 - Math.pow(1 - progress, 3); + + window.scrollTo(0, start * (1 - ease)); + + if (timeElapsed < duration) { + requestAnimationFrame(animateScroll); + } }; + requestAnimationFrame(animateScroll); +}; + + // Определяем, находимся ли мы на главной странице const isHomePage = location.pathname === "/"; diff --git a/src/app/styles/variables/_variables.scss b/src/app/styles/variables/_variables.scss index 533a70f..50b34c2 100644 --- a/src/app/styles/variables/_variables.scss +++ b/src/app/styles/variables/_variables.scss @@ -4,7 +4,7 @@ $bg-secondary: #343434; $bg-footer: #222222; $bg-form: #f5f5f7; $bg-card-lab: black; -$bg-image: rgba(0, 0, 0, 0.75); +$bg-image: rgba(0, 0, 0, 0.50); $text-primary: black; $text-secondary: white; diff --git a/src/pages/WpPostPage/WpPostPage.tsx b/src/pages/WpPostPage/WpPostPage.tsx index 219aca4..858dab3 100644 --- a/src/pages/WpPostPage/WpPostPage.tsx +++ b/src/pages/WpPostPage/WpPostPage.tsx @@ -4,6 +4,7 @@ import { useParams } from "react-router-dom"; import { ProjectsList } from "@/widgets/CardList/CardList"; import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost"; import { Helmet } from "react-helmet"; +import { useEffect } from "react"; function WpPostPage() { const params = useParams(); @@ -11,6 +12,12 @@ function WpPostPage() { const { data: post, isLoading, isError } = usePostById(postId || -1); + useEffect(() => { + if (post) { + window.scrollTo({ top: 0, behavior: "auto" }); + } + }, [post]); + if (!postId) { return ( <> @@ -66,9 +73,8 @@ function WpPostPage() { /> diff --git a/src/widgets/NewSlider/NewSlider.scss b/src/widgets/NewSlider/NewSlider.scss index 835a078..38e1577 100644 --- a/src/widgets/NewSlider/NewSlider.scss +++ b/src/widgets/NewSlider/NewSlider.scss @@ -17,7 +17,8 @@ } &__stage { - display: flex; + display: flex !important; + flex-wrap: nowrap; gap: 32px; padding: 0; margin: 0; @@ -25,7 +26,7 @@ &__stage-item { flex: 0 0 auto; - box-sizing: border-box; + width: auto !important; } } @@ -55,6 +56,8 @@ &__stage-item { padding: 0 5%; + box-sizing: border-box; + width: 100% !important; } } @@ -103,3 +106,11 @@ } } } +.sliderButton.disabled { + display: none; +} + +.slider.centered .alice-carousel__stage { + justify-content: center; + display: flex; +} diff --git a/src/widgets/NewSlider/NewSlider.tsx b/src/widgets/NewSlider/NewSlider.tsx index b780fb3..b8b2bed 100644 --- a/src/widgets/NewSlider/NewSlider.tsx +++ b/src/widgets/NewSlider/NewSlider.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import AliceCarousel from "react-alice-carousel"; import "react-alice-carousel/lib/alice-carousel.css"; @@ -17,6 +17,7 @@ function NewSlider({ }: SliderProps) { const { data: mediaData, isLoading, isError } = useMedia(); const [slideNumber, setSlideNumber] = useState(0); + const [windowWidth, setWindowWidth] = useState(typeof window !== 'undefined' ? window.innerWidth : 1024); const carouselRef = useRef(null); @@ -24,16 +25,31 @@ function NewSlider({ ? images.map((src, id) => ({ id, src, category: "", name: "" })) : mediaData?.filter((m) => m.category === category) || []; + useEffect(() => { + const handleResize = () => setWindowWidth(window.innerWidth); + window.addEventListener("resize", handleResize); + return () => window.removeEventListener("resize", handleResize); + }, []); + + const shouldShowControls = windowWidth < 768 + ? filteredMedia.length >= 2 + : filteredMedia.length > 4; + const responsive = { 0: { items: 1 }, - 768: { items: 1 }, - 1024: { items: 5 }, + 768: { items: 2 }, + 1024: { items: shouldShowControls ? 5 : filteredMedia.length }, }; const items = filteredMedia.map((media, index) => (
; if (isError) return
Ошибка при загрузке медиа
; - if (filteredMedia.length === 0) return
Нет изображений для отображения
; + if (filteredMedia.length === 0) return
Нет изображений
; return ( - +
-
- - -
-
+ {shouldShowControls && ( +
+ + +
+ )} + +
diff --git a/src/widgets/Numbers/Numbers.tsx b/src/widgets/Numbers/Numbers.tsx index 7ffebd4..03da71d 100644 --- a/src/widgets/Numbers/Numbers.tsx +++ b/src/widgets/Numbers/Numbers.tsx @@ -23,16 +23,16 @@ const Numbers = () => {
-

{yearsSince2015}

- +

50+

+
-

20+

- +

100+

+
-

30+

- +

500+

+
Illustration diff --git a/src/widgets/WpPost/Projects.scss b/src/widgets/WpPost/Projects.scss index aabbd83..260e184 100644 --- a/src/widgets/WpPost/Projects.scss +++ b/src/widgets/WpPost/Projects.scss @@ -22,6 +22,9 @@ $swiper-button-arrow-size: 20px; .header { //text-align: center; margin-bottom: 2em; + &.header--center { + text-align: center; + } } .wp-block-columns { diff --git a/src/widgets/WpPost/WpPost.tsx b/src/widgets/WpPost/WpPost.tsx index 404db0f..77b322f 100644 --- a/src/widgets/WpPost/WpPost.tsx +++ b/src/widgets/WpPost/WpPost.tsx @@ -32,7 +32,7 @@ export default function WpPost({ customComponent ) : ( <> - +

{title}

{Array.isArray(post.content) &&