Merge remote-tracking branch 'origin/projects'

This commit is contained in:
ifraimka1 committed 2025-06-02 14:09:35 +03:00
commit 35eb333475
16 files changed
+678 -344

No files matched your search

+36 -9
View File
@@ -37,6 +37,7 @@
"react-chartjs-2": "^5.2.0", "react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-fast-marquee": "^1.6.5", "react-fast-marquee": "^1.6.5",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.54.2", "react-hook-form": "^7.54.2",
"react-modal": "^3.16.3", "react-modal": "^3.16.3",
"react-router": "^7.1.1", "react-router": "^7.1.1",
@@ -56,6 +57,7 @@
"@types/lodash": "^4.17.16", "@types/lodash": "^4.17.16",
"@types/react": "^18.3.6", "@types/react": "^18.3.6",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11",
"@types/react-modal": "^3.16.3", "@types/react-modal": "^3.16.3",
"@types/react-router-hash-link": "^2.4.9", "@types/react-router-hash-link": "^2.4.9",
"@types/sass-loader": "^8.0.8", "@types/sass-loader": "^8.0.8",
@@ -2202,6 +2204,15 @@
"@types/react": "^18.0.0" "@types/react": "^18.0.0"
} }
}, },
"node_modules/@types/react-helmet": {
"version": "6.1.11",
"resolved": "https://registry.npmjs.org/@types/react-helmet/-/react-helmet-6.1.11.tgz",
"integrity": "sha512-0QcdGLddTERotCXo3VFlUSWO3ztraw8nZ6e3zJSgG7apwV5xt+pJUS8ewPBqT4NYB1optGLprNQzFleIY84u/g==",
"dev": true,
"dependencies": {
"@types/react": "*"
}
},
"node_modules/@types/react-modal": { "node_modules/@types/react-modal": {
"version": "3.16.3", "version": "3.16.3",
"resolved": "https://registry.npmjs.org/@types/react-modal/-/react-modal-3.16.3.tgz", "resolved": "https://registry.npmjs.org/@types/react-modal/-/react-modal-3.16.3.tgz",
@@ -7883,7 +7894,6 @@
"version": "2.9.1", "version": "2.9.1",
"resolved": "https://registry.npmjs.org/react-alice-carousel/-/react-alice-carousel-2.9.1.tgz", "resolved": "https://registry.npmjs.org/react-alice-carousel/-/react-alice-carousel-2.9.1.tgz",
"integrity": "sha512-/wQE4cqogKL/db+SoiiRmdj5j6C9I31pfzrmz8nuXmWmSl/UxxJz/O92W/ryxicTw1au+3mUW+drU3ZAhF3JPA==", "integrity": "sha512-/wQE4cqogKL/db+SoiiRmdj5j6C9I31pfzrmz8nuXmWmSl/UxxJz/O92W/ryxicTw1au+3mUW+drU3ZAhF3JPA==",
"license": "MIT",
"dependencies": { "dependencies": {
"vanilla-swipe": "^2.4.1" "vanilla-swipe": "^2.4.1"
}, },
@@ -7914,6 +7924,11 @@
"react": "^18.3.1" "react": "^18.3.1"
} }
}, },
"node_modules/react-fast-compare": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
"integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ=="
},
"node_modules/react-fast-marquee": { "node_modules/react-fast-marquee": {
"version": "1.6.5", "version": "1.6.5",
"resolved": "https://registry.npmjs.org/react-fast-marquee/-/react-fast-marquee-1.6.5.tgz", "resolved": "https://registry.npmjs.org/react-fast-marquee/-/react-fast-marquee-1.6.5.tgz",
@@ -7924,6 +7939,20 @@
"react-dom": ">= 16.8.0 || ^18.0.0" "react-dom": ">= 16.8.0 || ^18.0.0"
} }
}, },
"node_modules/react-helmet": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz",
"integrity": "sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==",
"dependencies": {
"object-assign": "^4.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.1.1",
"react-side-effect": "^2.1.0"
},
"peerDependencies": {
"react": ">=16.3.0"
}
},
"node_modules/react-hook-form": { "node_modules/react-hook-form": {
"version": "7.56.1", "version": "7.56.1",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz",
@@ -8052,13 +8081,12 @@
"react-router-dom": ">=4" "react-router-dom": ">=4"
} }
}, },
"node_modules/react-swipeable": { "node_modules/react-side-effect": {
"version": "7.0.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-7.0.2.tgz", "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.2.tgz",
"integrity": "sha512-v1Qx1l+aC2fdxKa9aKJiaU/ZxmJ5o98RMoFwUqAAzVWUcxgfHFXDDruCKXhw6zIYXm6V64JiHgP9f6mlME5l8w==", "integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
"license": "MIT",
"peerDependencies": { "peerDependencies": {
"react": "^16.8.3 || ^17 || ^18 || ^19.0.0 || ^19.0.0-rc" "react": "^16.3.0 || ^17.0.0 || ^18.0.0"
} }
}, },
"node_modules/react-transition-group": { "node_modules/react-transition-group": {
@@ -8718,8 +8746,7 @@
"node_modules/vanilla-swipe": { "node_modules/vanilla-swipe": {
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/vanilla-swipe/-/vanilla-swipe-2.4.1.tgz", "resolved": "https://registry.npmjs.org/vanilla-swipe/-/vanilla-swipe-2.4.1.tgz",
"integrity": "sha512-o6pfI0dipet88ZnPLV4Jx04Ia+U3xANh14vhROW2TOe/mrwk2JGG68+Z0BPoD1YUcQQEnK4SZBXkqFe+K1l7/w==", "integrity": "sha512-o6pfI0dipet88ZnPLV4Jx04Ia+U3xANh14vhROW2TOe/mrwk2JGG68+Z0BPoD1YUcQQEnK4SZBXkqFe+K1l7/w=="
"license": "MIT"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.4.19", "version": "5.4.19",
+2
View File
@@ -39,6 +39,7 @@
"react-chartjs-2": "^5.2.0", "react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-fast-marquee": "^1.6.5", "react-fast-marquee": "^1.6.5",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.54.2", "react-hook-form": "^7.54.2",
"react-modal": "^3.16.3", "react-modal": "^3.16.3",
"react-router": "^7.1.1", "react-router": "^7.1.1",
@@ -58,6 +59,7 @@
"@types/lodash": "^4.17.16", "@types/lodash": "^4.17.16",
"@types/react": "^18.3.6", "@types/react": "^18.3.6",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11",
"@types/react-modal": "^3.16.3", "@types/react-modal": "^3.16.3",
"@types/react-router-hash-link": "^2.4.9", "@types/react-router-hash-link": "^2.4.9",
"@types/sass-loader": "^8.0.8", "@types/sass-loader": "^8.0.8",
+3 -2
View File
@@ -2,16 +2,17 @@
@import "global"; @import "global";
@import "variables/variables"; @import "variables/variables";
@import "reset"; @import "reset";
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap'); @import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");
@font-face { @font-face {
font-family: 'Montserrat', sans-serif; font-family: "Montserrat", sans-serif;
font-style: normal; font-style: normal;
font-weight: 100 900; font-weight: 100 900;
font-display: swap; font-display: swap;
} }
.app { .app {
min-height: 100%; min-height: 100%;
overflow: hidden;
} }
#page { #page {
> #header, > #header,
+20 -5
View File
@@ -1,11 +1,26 @@
import { CategoryPage } from "@/widgets/CategoryPage/CategoryPage"; import { CategoryPage } from "@/widgets/CategoryPage/CategoryPage";
import Team from "@/widgets/Team"; import Team from "@/widgets/Team";
import PhotoGallery from "@/widgets/PhotoGallery"; import PhotoGallery from "@/widgets/PhotoGallery";
import { Helmet } from "react-helmet";
export default function AboutUs() { export default function AboutUs() {
return <> return (
<CategoryPage category="aboutus" /> <>
<Team /> <Helmet>
<PhotoGallery /> <title>О нас | СКБ "Компьютерное инновационное творчество"</title>
</> <meta
name="keywords"
content="СКБ, о нас, команда, Студенческое конструкторское бюро, Компьютерное инновационное творчество, ИКТИБ, ЮФУ, история СКБ, миссия, цели, задачи, коллектив, сотрудники, преподаватели, студенты"
/>
<meta
name="description"
content="Узнайте больше о Студенческом конструкторском бюро 'Компьютерное инновационное творчество' ИКТИБ ЮФУ - нашей команде, истории, миссии и целях. Мы создаем инновационные проекты и развиваем таланты в области IT."
/>
<meta name="robots" content="index,follow" />
</Helmet>
<CategoryPage category="aboutus" />
<Team />
<PhotoGallery />
</>
);
} }
+13
View File
@@ -1,4 +1,5 @@
import { YMaps, Map, Placemark } from "@pbe/react-yandex-maps"; import { YMaps, Map, Placemark } from "@pbe/react-yandex-maps";
import { Helmet } from "react-helmet";
import "./Contact.styles.scss"; import "./Contact.styles.scss";
import ContactForm from "@/widgets/ContactForm"; import ContactForm from "@/widgets/ContactForm";
@@ -6,6 +7,18 @@ import ContactForm from "@/widgets/ContactForm";
function Contact() { function Contact() {
return ( return (
<div id="page-contact" className="mainContainer"> <div id="page-contact" className="mainContainer">
<Helmet>
<title>Контакты | СКБ "Компьютерное инновационное творчество"</title>
<meta
name="keywords"
content="СКБ, контакты, связаться, Студенческое конструкторское бюро, Компьютерное инновационное творчество, ИКТИБ, ЮФУ, адрес, телефон, email, карта, местоположение, Таганрог"
/>
<meta
name="description"
content="Свяжитесь с нами! Контактная информация Студенческого конструкторского бюро 'Компьютерное инновационное творчество' ИКТИБ ЮФУ. Наш адрес: г. Таганрог, пер. Тургеневский, 44, ауд. 208."
/>
<meta name="robots" content="index,follow" />
</Helmet>
<div className="top-block"> <div className="top-block">
<div> <div>
<h1>Контакты</h1> <h1>Контакты</h1>
+16 -6
View File
@@ -5,13 +5,9 @@ import { RootContext } from "@/app/Layout/Root";
import Partners from "@/widgets/Partners"; import Partners from "@/widgets/Partners";
import Gallery from "@/pages/MainPage/ui/components/Gallery"; import Gallery from "@/pages/MainPage/ui/components/Gallery";
import ContactUs from "@/widgets/ContactUs"; import ContactUs from "@/widgets/ContactUs";
import { Helmet } from "react-helmet";
import { LabsList, NewsList, ProjectsList } from "@/widgets/CardList/CardList";
import { useMedia } from "@/modules/media/hooks/useMedia"; import { useMedia } from "@/modules/media/hooks/useMedia";
import {
LabsList,
NewsList,
ProjectsList,
} from "@/widgets/CardList/CardList";
import Numbers from "@/widgets/Numbers"; import Numbers from "@/widgets/Numbers";
const MainPage = () => { const MainPage = () => {
@@ -57,6 +53,20 @@ const MainPage = () => {
return ( return (
<div> <div>
<Helmet>
<title>СКБ "Компьютерное инновационное творчество"</title>
<meta
name="keywords"
content="СКБ, Студенческое конструкторское бюро, Компьютерное инновационное творчество, ИКТИБ, ЮФУ, программирование, IT, инновации, проекты, лаборатории, Таганрог, образование, технологии, разработка, студенческие проекты"
/>
<meta
name="description"
content="Студенческое конструкторское бюро 'Компьютерное инновационное творчество' ИКТИБ ЮФУ - площадка для реализации творческих и инновационных проектов студентов в области IT, робототехники, компьютерного зрения, VR/AR и других современных технологий."
/>
<meta name="robots" content="index,follow,archive" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</Helmet>
<div <div
id={styles.mainpageheader} id={styles.mainpageheader}
ref={(element) => setRef(element)} ref={(element) => setRef(element)}
+35 -2
View File
@@ -1,8 +1,9 @@
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Helmet } from "react-helmet";
import extLink from "@/shared/assets/images/extLink.svg"; import extLink from "@/shared/assets/images/extLink.svg";
import views from "@/shared/assets/images/views.svg"; import views from "@/shared/assets/images/views.svg";
import {SkeletonPost} from "@/shared/Components/SkeletonPost/SkeletonPost"; import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost";
import "./NewsItem.styles.scss"; import "./NewsItem.styles.scss";
import { useNewsById } from "@/modules/news/hooks/useNewsById"; import { useNewsById } from "@/modules/news/hooks/useNewsById";
@@ -31,7 +32,19 @@ function NewsItem() {
))} ))}
</div> </div>
); );
if (isError) return <center>Ошибка при загрузке новости</center>; if (isError)
return (
<>
<Helmet>
<title>
Ошибка загрузки новости | СКБ "Компьютерное инновационное
творчество"
</title>
<meta name="robots" content="noindex,nofollow" />
</Helmet>
<center>Ошибка при загрузке новости</center>
</>
);
const newsUrl = `${vkWallUrl}_${newsID}`; const newsUrl = `${vkWallUrl}_${newsID}`;
@@ -39,6 +52,26 @@ function NewsItem() {
<> <>
{news && ( {news && (
<> <>
<Helmet>
<title>
{news.heading || "Новость"} | СКБ "Компьютерное инновационное
творчество"
</title>
<meta
name="description"
content={
news.text?.[0]?.replace(/<[^>]*>/g, "").slice(0, 160) ||
"Новость СКБ 'Компьютерное инновационное творчество' ИКТИБ ЮФУ"
}
/>
<meta
name="keywords"
content={`СКБ, новости, ${
news.heading || ""
}, ИКТИБ, ЮФУ, студенческие проекты, инновации`}
/>
<meta name="robots" content="index,follow" />
</Helmet>
<PageHeader className="header"> <PageHeader className="header">
<h1>{news.heading}</h1> <h1>{news.heading}</h1>
</PageHeader> </PageHeader>
+17 -1
View File
@@ -1,3 +1,19 @@
import { Helmet } from "react-helmet";
export const NotFoundPage = () => { export const NotFoundPage = () => {
return <div>Такой страницы нету</div>; return (
<>
<Helmet>
<title>
Страница не найдена | СКБ "Компьютерное инновационное творчество"
</title>
<meta name="robots" content="noindex,nofollow" />
<meta
name="description"
content="Запрашиваемая страница не найдена. Вернитесь на главную страницу СКБ 'Компьютерное инновационное творчество'."
/>
</Helmet>
<div>Такой страницы нету</div>
</>
);
}; };
+54 -10
View File
@@ -3,6 +3,7 @@ import { WpPost } from "@/widgets/WpPost";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { ProjectsList } from "@/widgets/CardList/CardList"; import { ProjectsList } from "@/widgets/CardList/CardList";
import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost"; import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost";
import { Helmet } from "react-helmet";
function WpPostPage() { function WpPostPage() {
const params = useParams(); const params = useParams();
@@ -11,7 +12,17 @@ function WpPostPage() {
const { data: post, isLoading, isError } = usePostById(postId || -1); const { data: post, isLoading, isError } = usePostById(postId || -1);
if (!postId) { if (!postId) {
return <div>Не указан ID поста</div>; return (
<>
<Helmet>
<title>
Пост не найден | СКБ "Компьютерное инновационное творчество"
</title>
<meta name="robots" content="noindex,nofollow" />
</Helmet>
<div>Не указан ID поста</div>
</>
);
} }
if (isLoading) { if (isLoading) {
@@ -25,17 +36,50 @@ function WpPostPage() {
} }
if (isError) { if (isError) {
return <center>Ошибка при загрузке данных</center>; return (
}
console.log('post', post);
return (<>
{post &&
<> <>
<WpPost post={post} /> <Helmet>
{post?.categories?.includes("labs") && <ProjectsList tag={post?.tag || -1} />} <title>
Ошибка загрузки | СКБ "Компьютерное инновационное творчество"
</title>
<meta name="robots" content="noindex,nofollow" />
</Helmet>
<center>Ошибка при загрузке данных</center>
</> </>
} );
</>); }
return (
<>
{post && (
<>
<Helmet>
<title>
{post.title || "Пост"} | СКБ "Компьютерное инновационное
творчество"
</title>
<meta
name="description"
content={
"Публикация СКБ 'Компьютерное инновационное творчество' ИКТИБ ЮФУ"
}
/>
<meta
name="keywords"
content={`СКБ, ${post.title || ""}, ${
post.categories?.join(", ") || ""
}, ИКТИБ, ЮФУ`}
/>
<meta name="robots" content="index,follow" />
</Helmet>
<WpPost post={post} />
{post?.categories?.includes("labs") && (
<ProjectsList tag={post?.tag || -1} />
)}
</>
)}
</>
);
} }
export default WpPostPage; export default WpPostPage;
+214 -102
View File
@@ -1,136 +1,248 @@
.slider { .slider {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
padding: 10px 0; padding: 10px 0;
user-select: none; // Запрещаем выделение всего содержимого слайдера
&.has-pagination { &.has-pagination {
.swiper { .swiper {
padding-bottom: 40px; padding-bottom: 40px;
}
} }
}
.swiper-slide { .slider-item {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.slide-image {
.slide-image { width: 100%;
width: 100%; height: auto;
height: auto; height: 350px;
height: 350px; object-fit: cover;
object-fit: cover; object-position: center center;
object-position: center center; // border-radius: 8px;
border-radius: 8px; pointer-events: none;
pointer-events: none; user-select: none; // Дополнительная защита от выделения изображений
}
} }
}
.swiper-wrapper:has(.swiper-slide.single) { .swiper-wrapper:has(.swiper-slide.single) {
justify-content: center; justify-content: center;
.swiper-slide.single { .slider-item.single {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.slide-image { .slide-image {
width: auto; width: auto;
height: 100%; height: 100%;
object-position: center center; object-position: center center;
pointer-events: none; pointer-events: none;
border-radius: 0px; user-select: none; // Запрещаем выделение и для одиночных изображений
} border-radius: 0px;
} }
} }
}
} }
/* стрелки */ /* стрелки */
/* Кастомные стрелки */ /* Кастомные стрелки */
.custom-navigation { .custom-navigation {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
position: absolute; position: absolute;
top: 50%; top: 50%;
width: 100%; transform: translateY(-50%);
transform: translateY(-50%); background: rgba(0, 0, 0, 0.7);
z-index: 10; color: white;
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
transition: all 0.2s ease;
&:hover {
background: rgba(0, 0, 0, 0.9);
transform: translateY(-50%) scale(1.1);
}
&[disabled] {
display: none;
}
}
.alice-carousel__wrapper {
width: 185%;
height: auto;
left: -240px;
user-select: none;
}
.alice-carousel__prev-btn {
left: 10px;
&::before {
content: "←";
}
} }
.custom-prev, .alice-carousel__next-btn {
.custom-next { right: 10px;
width: 60px;
height: 60px; &::before {
background-color: white; content: "→";
border-radius: 50%; }
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
cursor: pointer;
font-size: 24px;
border: none;
} }
.custom-prev { // Стили для Alice Carousel (добавить в конец файла)
margin-left: -70px; .slider {
// Ваши существующие стили остаются без изменений
@media (max-width: 768px) { // Стили для Alice Carousel
margin-left: 0px; .alice-carousel {
&__wrapper {
position: relative;
} }
}
.custom-next { &__stage {
margin-right: -70px; padding: 0;
@media (max-width: 768px) {
margin-right: 0px;
} }
}
.slider.news { &__stage-item {
.swiper-slide { padding: 0 10px;
opacity: 0.5; }
transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
height: 65vh;
.slide-image { // Используем ваши оригинальные стили для кнопок навигации
height: 500px; &__prev-btn,
&__next-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 60px;
height: 60px;
background-color: white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
cursor: pointer;
font-size: 24px;
border: none;
z-index: 10;
}
&__prev-btn {
left: -70px;
&::before {
content: "‹";
}
@media (max-width: 768px) {
left: 0px;
}
}
&__next-btn {
right: -70px;
&::before {
content: "›";
}
@media (max-width: 768px) {
right: 0px;
}
}
// Стили для точек навигации
&__dots {
display: flex;
justify-content: center;
gap: 8px;
margin-top: 15px;
&-item {
width: 10px;
height: 10px;
border-radius: 50%;
background: rgba(0, 0, 0, 0.3);
cursor: pointer;
transition: all 0.2s ease;
border: none;
&.__active {
background: #007bff;
transform: scale(1.2);
} }
@media (max-width: 768px) { &:hover {
opacity: 1; background: rgba(0, 0, 0, 0.6);
transition: none;
height: 48vh;
.slide-image {
height: 350px;
}
} }
}
} }
.swiper-slide-active { // Скрываем точки когда они отключены
opacity: 1; &.__disabled-dots .alice-carousel__dots {
display: none;
} }
&.no-animation .swiper-slide { // Скрываем кнопки когда они отключены
transition: none; &.__disabled-buttons {
} .alice-carousel__prev-btn,
.alice-carousel__next-btn {
.swiper-wrapper:has(.swiper-slide.single) { display: none;
justify-content: center !important; }
}
.swiper-slide-prev,
.swiper-slide-next {
opacity: 0.7;
transform: scale(0.9);
@media (max-width: 768px) {
opacity: 1;
transform: none;
}
} }
}
}
.slider-item {
display: flex;
justify-content: center;
align-items: center;
}
.slide-image {
width: 100%;
height: 300px;
object-fit: cover;
border-radius: 4px;
@media (max-width: 768px) {
height: 250px;
}
}
// Responsive стили
@media (max-width: 768px) {
.slider {
.alice-carousel__stage-item {
padding: 0 5px;
}
.alice-carousel__prev-btn,
.alice-carousel__next-btn {
width: 35px;
height: 35px;
font-size: 16px;
}
.alice-carousel__prev-btn {
left: 5px;
}
.alice-carousel__next-btn {
right: 5px;
}
}
} }
+69 -88
View File
@@ -1,119 +1,100 @@
import { createContext, useEffect, useState } from "react"; import { useState } from "react";
import { Swiper, SwiperSlide } from "swiper/react"; import AliceCarousel from "react-alice-carousel";
import { Navigation, Pagination } from "swiper/modules"; import "react-alice-carousel/lib/alice-carousel.css";
import { useMedia } from "@/modules/media/hooks/useMedia"; import { useMedia } from "@/modules/media/hooks/useMedia";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
import "./Slider.styles.scss";
import { MediaItem } from "@/modules/media/api/get"; import { MediaItem } from "@/modules/media/api/get";
import { SkeletonSlider } from "@/shared/Components/SkeletonSlider/SkeletonSlider"; import { SkeletonSlider } from "@/shared/Components/SkeletonSlider/SkeletonSlider";
import "./Slider.styles.scss";
interface SliderProps { import { SliderContext, SliderProps } from "@/widgets/Slider/context";
autoPlay?: boolean;
autoPlayTime?: number;
images?: string[];
category?: string;
customPerSlide?: number;
}
interface SliderContextType {
slideNumber: number;
mediaList: MediaItem[];
setSlideNumber?: (slideNumber: number) => void;
goToSlide: (slideNumber: number) => void; // Added for Dot component
slidesCount: number; // Added for Dots component
}
export const SliderContext = createContext<SliderContextType>({
slideNumber: 0,
mediaList: [],
goToSlide: () => { },
slidesCount: 0,
});
function Slider({ function Slider({
autoPlay = false, autoPlay = false,
autoPlayTime = 3000, autoPlayTime = 3000,
images, images,
category, category = "gallery",
customPerSlide = 0, customPerSlide = 6,
}: SliderProps) { }: SliderProps) {
const { data: mediaData, isLoading, isError } = useMedia(); const { data: mediaData, isLoading, isError } = useMedia();
const [enableButtons, setEnableButtons] = useState(false);
const [slideNumber, setSlideNumber] = useState(0); const [slideNumber, setSlideNumber] = useState(0);
const filteredMedia: MediaItem[] = images const filteredMedia: MediaItem[] = images
? images.map((src, id) => ({ id, src, category: "", name: "" })) ? images.map((src, id) => ({ id, src, category: "", name: "" }))
: mediaData?.filter((m) => m.category === category) || []; : mediaData?.filter((m) => m.category === category) || [];
useEffect(() => { const getSlidesPerView = (width: number = window.innerWidth) => {
const count = filteredMedia.length; if (customPerSlide > 0) return customPerSlide;
const threshold = customPerSlide > 0 ? customPerSlide : 2; if (width < 768) return 1;
setEnableButtons(count > threshold); if (width < 1024) return 2;
}, [filteredMedia, customPerSlide]); if (width < 1920) return 10;
return 10;
};
const currentSlidesPerView = getSlidesPerView();
if (isLoading) const shouldShowNavigation = filteredMedia.length > currentSlidesPerView;
return ( const shouldShowDots = filteredMedia.length > currentSlidesPerView;
<div >
{[...Array(1)].map((_, index) => ( const responsive = {
<SkeletonSlider key={index} /> 0: { items: 1 },
))} 400: { items: 2 },
</div> 600: { items: 3 },
); 800: { items: 3 },
1000: { items: 4 },
1200: { items: 4 },
1400: { items: 5 },
1600: { items: 7 },
};
console.log("responsive object:", responsive);
const items = filteredMedia.map((media) => (
<div key={media.id} className="slider-item">
<img
src={media.src}
alt={`slide-${media.id}`}
className="slide-image"
loading="lazy"
/>
</div>
));
const handleSlideChanged = (event: { item: number }) => {
setSlideNumber(event.item);
};
const goToSlide = (index: number) => {
setSlideNumber(index);
};
if (isLoading) return <SkeletonSlider />;
if (isError) return <center>Ошибка при загрузке медиа</center>; if (isError) return <center>Ошибка при загрузке медиа</center>;
if (filteredMedia.length === 0)
return <div>Нет изображений для отображения</div>;
return ( return (
<SliderContext.Provider <SliderContext.Provider
value={{ value={{
slideNumber, slideNumber,
mediaList: filteredMedia, mediaList: filteredMedia,
goToSlide: setSlideNumber, goToSlide,
slidesCount: filteredMedia.length, slidesCount: filteredMedia.length,
}} }}
> >
<div className="slider"> <div className="slider">
<Swiper <AliceCarousel
modules={[Navigation, Pagination]} items={items}
spaceBetween={20} responsive={responsive}
slidesPerGroup={1} controlsStrategy="alternate"
loop={true} autoPlay={autoPlay && shouldShowNavigation}
lazyPreloadPrevNext={0} autoPlayInterval={autoPlayTime}
navigation={enableButtons} infinite={shouldShowNavigation}
pagination={{ clickable: enableButtons }} disableDotsControls={!shouldShowDots}
autoplay={ disableButtonsControls={!shouldShowNavigation}
autoPlay activeIndex={slideNumber}
? { delay: autoPlayTime, disableOnInteraction: false } onSlideChanged={handleSlideChanged}
: false mouseTracking={shouldShowNavigation}
} touchTracking={shouldShowNavigation}
onSlideChange={(swiper) => setSlideNumber(swiper.activeIndex)} keyboardNavigation={shouldShowNavigation}
breakpoints={{ />
0: { slidesPerView: 1 }, </div>
768: { slidesPerView: 2 },
1024: { slidesPerView: customPerSlide > 0 ? customPerSlide : 2 },
}}
loopAddBlankSlides={true}
>
{filteredMedia.map((media) => (
<SwiperSlide
key={media.id}
className={
filteredMedia.length === 1 ? "swiper-slide single" : "swiper-slide"
}
>
<img
src={media.src}
alt={`slide-${media.id}`}
className="slide-image"
loading="lazy"
/>
</SwiperSlide>
))}
</Swiper>
</div>
</SliderContext.Provider> </SliderContext.Provider>
); );
} }
+2 -1
View File
@@ -1,7 +1,8 @@
import { useContext } from "react"; import { useContext } from "react";
import { SliderContext } from "../Slider";
import Dot from "./Dot"; // Fixed import - was incorrectly importing from "./Dots" import Dot from "./Dot"; // Fixed import - was incorrectly importing from "./Dots"
import { ReactElement } from "react"; import { ReactElement } from "react";
import { SliderContext } from "@/widgets/Slider/context";
function Dots(): ReactElement { function Dots(): ReactElement {
const { slidesCount } = useContext(SliderContext); const { slidesCount } = useContext(SliderContext);
+2 -1
View File
@@ -1,7 +1,8 @@
import { useContext } from "react"; import { useContext } from "react";
import Slide from "./Slide"; import Slide from "./Slide";
import { SliderContext } from "../Slider";
import { MediaItem } from "@/modules/media/api/get"; import { MediaItem } from "@/modules/media/api/get";
import { SliderContext } from "@/widgets/Slider/context";
export default function SlidesList() { export default function SlidesList() {
const { slideNumber, mediaList } = useContext(SliderContext); const { slideNumber, mediaList } = useContext(SliderContext);
+22
View File
@@ -0,0 +1,22 @@
import { MediaItem } from "@/modules/media/api/get";
import { createContext } from "react";
export interface SliderProps {
autoPlay?: boolean;
autoPlayTime?: number;
images?: string[];
category?: string;
customPerSlide?: number;
}
interface SliderContextType {
slideNumber: number;
mediaList: MediaItem[];
setSlideNumber?: (slideNumber: number) => void;
goToSlide: (slideNumber: number) => void;
slidesCount: number;
}
export const SliderContext = createContext<SliderContextType>({
slideNumber: 0,
mediaList: [],
goToSlide: () => {},
slidesCount: 0,
});
+172 -117
View File
@@ -1,146 +1,201 @@
$color-highlight: #072AC8; $color-highlight: #072ac8;
$table-header-color: #EEEEEE; $table-header-color: #eeeeee;
$table-body-bg: #ffffff; $table-body-bg: #ffffff;
$color-usual: #ACACAC; $color-usual: #acacac;
$border-raduis: 16px; $border-raduis: 16px;
$background-tape: #F5F5F7; $background-tape: #f5f5f7;
$slider: 476px; $slider: 476px;
$swiper-button-size: 48px; $swiper-button-size: 48px;
$swiper-button-arrow-size: 20px; $swiper-button-arrow-size: 20px;
:root { :root {
--wp--preset--spacing--10: 5%; --wp--preset--spacing--10: 5%;
--wp--preset--spacing--20: 10%; --wp--preset--spacing--20: 10%;
--wp--preset--spacing--30: 15%; --wp--preset--spacing--30: 15%;
--wp--preset--spacing--40: 20%; --wp--preset--spacing--40: 20%;
--wp--preset--spacing--50: 25%; --wp--preset--spacing--50: 25%;
--wp--preset--spacing--60: 30%; --wp--preset--spacing--60: 30%;
} }
.project { .project {
.header { .header {
text-align: center;
margin-bottom: 2em;
}
.wp-block-columns {
margin-bottom: 2em;
}
.is-layout-flex {
display: flex;
justify-content: space-between;
gap: 2em;
figure {
img {
max-width: 100%;
height: auto;
object-fit: contain !important; // Wordpress накидывает styles к элементу, приходится перебивать
}
}
}
.has-text-align-center {
text-align: center;
}
.has-text-align-justify {
text-align: justify;
}
.is-style-rounded * {
border-radius: 16px;
}
// "Цитаты"
.wp-block-pullquote {
* {
margin-bottom: 0;
}
blockquote {
display: flex;
justify-content: center;
position: absolute;
left: 0;
width: 100%;
padding: 16px 0;
background: $background-tape;
p {
display: inline-block;
max-width: 40%;
text-align: center; text-align: center;
margin-bottom: 2em; }
} }
}
.wp-block-columns { // Таблица
margin-bottom: 2em; .table-wrapper {
} border: 1px solid $table-header-color;
border-radius: $border-raduis;
overflow-x: auto;
background: $table-header-color;
.is-layout-flex { .comparison-table {
display: flex; width: 100%;
justify-content: space-between; border-collapse: separate;
gap: 2em; border-spacing: 0;
font-size: 18px;
word-wrap: normal;
figure { th,
img { td {
max-width: 100%; max-width: 200px;
height: auto; border: none;
object-fit: contain !important; // Wordpress накидывает styles к элементу, приходится перебивать padding: 12px 16px;
} vertical-align: middle;
} background: $table-body-bg;
} }
.has-text-align-center { tr:not(:last-child) th,
tr:not(:last-child) td {
border-bottom: 1px solid $table-header-color;
}
tr:last-child th,
tr:last-child td {
border-bottom: 1px solid $table-body-bg;
}
thead th {
background-color: $table-header-color;
font-weight: 400;
padding: 12px 16px;
border: none;
}
tbody td:not(:first-child),
thead th:not(:first-child) {
text-align: center; text-align: center;
} }
.has-text-align-justify { thead th.highlight {
text-align: justify; font-weight: 600;
} font-size: 24px;
border-radius: 10px 10px 0 0;
border-bottom: 1px solid $color-highlight;
color: #ffffff;
background-color: $color-highlight;
}
.is-style-rounded * { tbody td.highlight {
border-radius: 16px; border: 1px solid $color-highlight;
} border-top: none;
// "Цитаты" .icon {
.wp-block-pullquote { filter: brightness(0) saturate(100%) invert(26%) sepia(94%)
* { saturate(2350%) hue-rotate(225deg) brightness(95%) contrast(93%);
margin-bottom: 0;
}
blockquote {
display: flex;
justify-content: center;
position: absolute;
left: 0;
width: 100%;
padding: 16px 0;
background: $background-tape;
p {
display: inline-block;
max-width: 40%;
text-align: center;
}
} }
}
} }
}
// Таблица .slider {
.table-wrapper { margin-top: 2em;
border: 1px solid $table-header-color; padding: 0;
border-radius: $border-raduis;
overflow-x: auto;
background: $table-header-color;
.comparison-table { .swiper {
width: 100%; padding-top: 4em;
border-collapse: separate; overflow: visible;
border-spacing: 0; .swiper-wrapper {
font-size: 18px; left: -250px;
word-wrap: normal; }
.swiper-wrapper .swiper-slide {
aspect-ratio: 1 / 1;
position: relative;
th, .slide-image {
td { width: 100%;
max-width: 200px; height: 100%;
border: none; object-fit: cover;
//padding: 12px 16px; border-radius: 0;
vertical-align: middle;
background: $table-body-bg;
}
tr:not(:last-child) th,
tr:not(:last-child) td {
border-bottom: 1px solid $table-header-color;
}
tr:last-child th,
tr:last-child td {
border-bottom: 1px solid $table-body-bg;
}
thead th {
background-color: $table-header-color;
font-weight: 400;
padding: 12px 16px;
border: none;
}
tbody td:not(:first-child),
thead th:not(:first-child) {
text-align: center;
}
thead th.highlight {
font-weight: 600;
font-size: 24px;
border-radius: 10px 10px 0 0;
border-bottom: 1px solid $color-highlight;
color: #ffffff;
background-color: $color-highlight;
}
tbody td.highlight {
border: 1px solid $color-highlight;
border-top: none;
.icon {
filter: brightness(0) saturate(100%) invert(26%) sepia(94%) saturate(2350%) hue-rotate(225deg) brightness(95%) contrast(93%);
}
}
} }
}
.swiper-button-prev,
.swiper-button-next {
background: url("/./src/shared/assets/images/arrow2-0.svg") center
center no-repeat;
top: calc($swiper-button-size / 2);
left: auto;
width: $swiper-button-size;
height: $swiper-button-size;
color: transparent;
border: 2px solid black;
border-radius: 100%;
}
.swiper-button-prev::after,
.swiper-button-next::after {
font-size: $swiper-button-arrow-size;
}
.swiper-button-prev {
transform: scaleX(-1);
right: calc(24px + $swiper-button-size);
}
.swiper-button-next {
right: 0;
}
.swiper-pagination {
display: none;
}
} }
}
} }
+1
View File
@@ -8,6 +8,7 @@ import { App } from "@/shared/types/app";
import "./Projects.scss"; import "./Projects.scss";
import NewSlider from "../NewSlider/NewSlider"; import NewSlider from "../NewSlider/NewSlider";
import { getCustomProject } from "./customProjects"; import { getCustomProject } from "./customProjects";
import Slider from "../Slider/Slider";
interface WpPostProps { interface WpPostProps {
post: App.WpPostPage; post: App.WpPostPage;