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/Contact/Contact.tsx b/src/pages/Contact/Contact.tsx index e0cf22e..ccba046 100644 --- a/src/pages/Contact/Contact.tsx +++ b/src/pages/Contact/Contact.tsx @@ -40,17 +40,19 @@ function Contact() {
- + ); } diff --git a/src/pages/CustomProjects/LabBoard/LabBoard.module.scss b/src/pages/CustomProjects/LabBoard/LabBoard.module.scss index e012069..472b72c 100644 --- a/src/pages/CustomProjects/LabBoard/LabBoard.module.scss +++ b/src/pages/CustomProjects/LabBoard/LabBoard.module.scss @@ -525,4 +525,25 @@ @media (min-width: 769px) { display: none; } +} + +.infinitySymbol { + width: 96px; + height: 64px; + margin-bottom: 16px; + display: flex; + align-items: center; + justify-content: center; + + svg { + display: block; + margin: 0 auto; + } +} + +@media (max-width: 768px) { + .infinitySymbol { + width: 72px; + height: 48px; + } } \ No newline at end of file diff --git a/src/pages/CustomProjects/LabBoard/LabBoard.tsx b/src/pages/CustomProjects/LabBoard/LabBoard.tsx index db6babb..ec8c16f 100644 --- a/src/pages/CustomProjects/LabBoard/LabBoard.tsx +++ b/src/pages/CustomProjects/LabBoard/LabBoard.tsx @@ -133,10 +133,31 @@ function LabBoard() {

1

- +
-

∞

+
+ + + + + + + + + +
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/shared/api/wp-client.ts b/src/shared/api/wp-client.ts index 674c0a7..277b3f3 100644 --- a/src/shared/api/wp-client.ts +++ b/src/shared/api/wp-client.ts @@ -1,7 +1,7 @@ import WPAPI from "wpapi"; export const wp = new WPAPI({ - endpoint: "https://test.skbkit.ru/wp-json/", + endpoint: "https://kit.sfedu.ru/wp-json/", username: "admin", password: "admin", }); diff --git a/src/shared/assets/images/footer/iconIctis.png b/src/shared/assets/images/footer/iconIctis.png index bab2383..8f010f9 100644 Binary files a/src/shared/assets/images/footer/iconIctis.png and b/src/shared/assets/images/footer/iconIctis.png differ diff --git a/src/shared/assets/images/footer/iconSfedu.png b/src/shared/assets/images/footer/iconSfedu.png index ff94762..c477ec6 100644 Binary files a/src/shared/assets/images/footer/iconSfedu.png and b/src/shared/assets/images/footer/iconSfedu.png differ diff --git a/src/shared/assets/images/footer/iconVK.svg b/src/shared/assets/images/footer/iconVK.svg index 308d4f9..6e4162c 100644 --- a/src/shared/assets/images/footer/iconVK.svg +++ b/src/shared/assets/images/footer/iconVK.svg @@ -1,3 +1,3 @@ - - \ No newline at end of file + + diff --git a/src/widgets/CardList/CardList.module.scss b/src/widgets/CardList/CardList.module.scss index 01b9602..8498dc9 100644 --- a/src/widgets/CardList/CardList.module.scss +++ b/src/widgets/CardList/CardList.module.scss @@ -6,6 +6,14 @@ line-height: 44px; margin-top: 0; margin-bottom: 8px; + color: inherit; + text-decoration: none; + transition: color 0.2s ease; + cursor: pointer; + + &:hover { + color: #072AC8; + } @include mediaMax($tablet-max-width) { font-size: 24px; diff --git a/src/widgets/CardList/CardList.tsx b/src/widgets/CardList/CardList.tsx index 4a11929..20e0726 100644 --- a/src/widgets/CardList/CardList.tsx +++ b/src/widgets/CardList/CardList.tsx @@ -10,6 +10,17 @@ import { transformPostsToCardData, } from "@/widgets/CardList/CardListFunctions"; import { usePostProjects } from "@/modules/posts/hooks/usePostProjects"; +import { Link } from "react-router-dom"; +import { useEffect } from "react"; + +// Компонент для прокрутки вверх при переходе +const ScrollToTopOnMount = () => { + useEffect(() => { + window.scrollTo(0, 0); + }, []); + + return null; +}; interface ListProps { gridConfig?: GridConfig; @@ -22,23 +33,30 @@ const NewsList = ({ const { data: newsData, isLoading, isError } = useNews(); return ( - -
- {newsData && ( - - )} -
-
+ <> + + +
+ {newsData && ( + window.scrollTo(0, 0)}> + Новости + + } + /> + )} +
+
+ ); }; @@ -49,20 +67,27 @@ const LabsList = ({ const labs = postsData?.labs ? Object.values(postsData.labs) : []; return ( - -
- -
-
+ <> + + +
+ window.scrollTo(0, 0)}> + Наши лаборатории + + } + /> +
+
+ ); }; @@ -74,22 +99,28 @@ const ProjectsList = ({ const projects = data ?? []; return ( - -
- -
-
+ <> + + +
+ window.scrollTo(0, 0)}> + Наши проекты + + } + /> +
+
+ ); }; -export { NewsList, LabsList, ProjectsList }; +export { NewsList, LabsList, ProjectsList }; \ No newline at end of file diff --git a/src/widgets/CardList/CardListTemplate.tsx b/src/widgets/CardList/CardListTemplate.tsx index 41355c8..46394fd 100644 --- a/src/widgets/CardList/CardListTemplate.tsx +++ b/src/widgets/CardList/CardListTemplate.tsx @@ -10,7 +10,7 @@ export const CardListTemplate = ({ gridConfig = { desktop: 3, tablet: 2, mobile: 1 }, title = "Наши лаборатории", }: CardListProps) => { - const itemsArray = Object.values(items); + const itemsArray = Object.values(items).reverse(); return ( <> diff --git a/src/widgets/CardList/types.ts b/src/widgets/CardList/types.ts index 49d8837..eb9a095 100644 --- a/src/widgets/CardList/types.ts +++ b/src/widgets/CardList/types.ts @@ -18,5 +18,5 @@ export interface CardListProps { items: Record; // Объект объектов variant?: "lab" | "news" | "project"; gridConfig?: GridConfig; - title: string; + title: string | React.ReactNode; } 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..c9e54d6 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"; @@ -10,13 +10,12 @@ import "./NewSlider.scss"; import { SliderContext, SliderProps } from "@/widgets/NewSlider/context"; function NewSlider({ - autoPlay = false, - autoPlayTime = 3000, images, category = "gallery", }: 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 +23,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 ( { + carouselRef.current?.slideTo(index); + setSlideNumber(index); + }, slidesCount: filteredMedia.length, }} >
-
- - -
-
+ {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/Partners/Partners.module.scss b/src/widgets/Partners/Partners.module.scss index 595a361..769e606 100644 --- a/src/widgets/Partners/Partners.module.scss +++ b/src/widgets/Partners/Partners.module.scss @@ -48,7 +48,7 @@ $logo-size: 200px; .logo { width: $logo-size; height: $logo-size; - border-radius: 50%; + //border-radius: 50%; object-fit: cover; pointer-events: none; } diff --git a/src/widgets/Slider/Slider.styles.scss b/src/widgets/Slider/Slider.styles.scss index 7509c41..c4c875d 100644 --- a/src/widgets/Slider/Slider.styles.scss +++ b/src/widgets/Slider/Slider.styles.scss @@ -41,7 +41,7 @@ .swiper-slide.single { .slide-image { - width: auto; + width: 100%; height: 100%; border-radius: 0; } diff --git a/src/widgets/WpPost/Projects.scss b/src/widgets/WpPost/Projects.scss index 7b3c458..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 { @@ -202,4 +205,29 @@ $swiper-button-arrow-size: 20px; } } } -} \ No newline at end of file +} + +@media (max-width: 768px) { + .project .is-layout-flex { + flex-direction: column !important; + align-items: stretch !important; + } + + .project .is-layout-flex figure { + width: 100% !important; + margin: 0 0 1em !important; + } + + .project .is-layout-flex figure img { + display: block !important; + width: 100% !important; + height: auto !important; + max-width: none !important; + object-fit: contain !important; + } + + .project .wp-block-column { + flex: 0 0 100% !important; + max-width: 100% !important; + } +} 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) &&