mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 05:49:45 +00:00
Merge branch 'master' of https://github.com/ifraimka1/skb
This commit is contained in:
commit
da9a546a94
22 files changed
+263
-102
No files matched your search
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<title>Завод</title>
|
<title>СКБ "Компьютерное инновационное творчество"</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+19
-5
@@ -60,14 +60,28 @@ function Root() {
|
|||||||
};
|
};
|
||||||
}, [hasScrolled]);
|
}, [hasScrolled]);
|
||||||
|
|
||||||
// Ускоренный плавный скролл вверх
|
// скролл вверх
|
||||||
const scrollToTop = () => {
|
const scrollToTop = () => {
|
||||||
window.scrollTo({
|
const duration = 900;
|
||||||
top: 0,
|
const start = window.scrollY;
|
||||||
behavior: "smooth",
|
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 === "/";
|
const isHomePage = location.pathname === "/";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ $bg-secondary: #343434;
|
|||||||
$bg-footer: #222222;
|
$bg-footer: #222222;
|
||||||
$bg-form: #f5f5f7;
|
$bg-form: #f5f5f7;
|
||||||
$bg-card-lab: black;
|
$bg-card-lab: black;
|
||||||
$bg-image: rgba(0, 0, 0, 0.75);
|
$bg-image: rgba(0, 0, 0, 0.50);
|
||||||
|
|
||||||
$text-primary: black;
|
$text-primary: black;
|
||||||
$text-secondary: white;
|
$text-secondary: white;
|
||||||
|
|||||||
@@ -40,17 +40,19 @@ function Contact() {
|
|||||||
<Map
|
<Map
|
||||||
defaultState={{
|
defaultState={{
|
||||||
center: [47.20669, 38.929113],
|
center: [47.20669, 38.929113],
|
||||||
zoom: 13,
|
zoom: 17,
|
||||||
controls: ["zoomControl", "fullscreenControl"],
|
controls: ["zoomControl", "fullscreenControl"],
|
||||||
}}
|
}}
|
||||||
modules={["control.ZoomControl", "control.FullscreenControl"]}
|
modules={["control.ZoomControl", "control.FullscreenControl"]}
|
||||||
|
width="500px"
|
||||||
|
height="200px"
|
||||||
>
|
>
|
||||||
<Placemark defaultGeometry={[47.20669, 38.929113]} />
|
<Placemark defaultGeometry={[47.20669, 38.929113]} />
|
||||||
</Map>
|
</Map>
|
||||||
</YMaps>
|
</YMaps>
|
||||||
</div >
|
</div >
|
||||||
<div id="contact-form-anchor"></div>
|
<div id="contact-form-anchor"></div>
|
||||||
<ContactForm />
|
<ContactForm />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,3 +526,24 @@
|
|||||||
display: none;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -133,10 +133,31 @@ function LabBoard() {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.numberBlock}>
|
<div className={styles.numberBlock}>
|
||||||
<p className={styles.number}>1</p>
|
<p className={styles.number}>1</p>
|
||||||
<label className={styles.numberLabel}>микроконтроллер stm32</label>
|
<label className={styles.numberLabel}>микроконтроллер STM32</label>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.numberBlock}>
|
<div className={styles.numberBlock}>
|
||||||
<p className={styles.number}>∞</p>
|
<div className={styles.infinitySymbol}>
|
||||||
|
<svg
|
||||||
|
width="96"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 96 64"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="infinityGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||||
|
<stop offset="0%" stopColor="#0867F4" />
|
||||||
|
<stop offset="100%" stopColor="#072AC8" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<path
|
||||||
|
d="M12 32C12 18 36 18 48 32C60 46 84 46 84 32C84 18 60 18 48 32C36 46 12 46 12 32Z"
|
||||||
|
stroke="url(#infinityGradient)"
|
||||||
|
strokeWidth="7"
|
||||||
|
strokeLinecap="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
<label className={styles.numberLabel}>опыта</label>
|
<label className={styles.numberLabel}>опыта</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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";
|
import { Helmet } from "react-helmet";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
function WpPostPage() {
|
function WpPostPage() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
@@ -11,6 +12,12 @@ function WpPostPage() {
|
|||||||
|
|
||||||
const { data: post, isLoading, isError } = usePostById(postId || -1);
|
const { data: post, isLoading, isError } = usePostById(postId || -1);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (post) {
|
||||||
|
window.scrollTo({ top: 0, behavior: "auto" });
|
||||||
|
}
|
||||||
|
}, [post]);
|
||||||
|
|
||||||
if (!postId) {
|
if (!postId) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -66,9 +73,8 @@ function WpPostPage() {
|
|||||||
/>
|
/>
|
||||||
<meta
|
<meta
|
||||||
name="keywords"
|
name="keywords"
|
||||||
content={`СКБ, ${post.title || ""}, ${
|
content={`СКБ, ${post.title || ""}, ${post.categories?.join(", ") || ""
|
||||||
post.categories?.join(", ") || ""
|
}, ИКТИБ, ЮФУ`}
|
||||||
}, ИКТИБ, ЮФУ`}
|
|
||||||
/>
|
/>
|
||||||
<meta name="robots" content="index,follow" />
|
<meta name="robots" content="index,follow" />
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import WPAPI from "wpapi";
|
import WPAPI from "wpapi";
|
||||||
|
|
||||||
export const wp = new WPAPI({
|
export const wp = new WPAPI({
|
||||||
endpoint: "https://test.skbkit.ru/wp-json/",
|
endpoint: "https://kit.sfedu.ru/wp-json/",
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin",
|
password: "admin",
|
||||||
});
|
});
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 436 KiB After Width: | Height: | Size: 58 KiB |
@@ -1,3 +1,3 @@
|
|||||||
<svg width="22" height="13" viewBox="0 0 22 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="22" height="13" viewBox="0 0 22 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M12.0462 12.5637C12.0462 12.5637 12.4312 12.5217 12.6284 12.3138C12.8089 12.1233 12.8027 11.7638 12.8027 11.7638C12.8027 11.7638 12.7787 10.0851 13.5727 9.83727C14.3553 9.59351 15.3601 11.4606 16.4265 12.1786C17.232 12.7215 17.8434 12.6026 17.8434 12.6026L20.693 12.5637C20.693 12.5637 22.183 12.4736 21.4766 11.3234C21.4181 11.2292 21.0644 10.4723 19.3584 8.91753C17.5711 7.29006 17.8111 7.55328 19.9626 4.73772C21.2731 3.02319 21.7969 1.97645 21.6331 1.52887C21.4776 1.10075 20.5135 1.21444 20.5135 1.21444L17.3061 1.2339C17.3061 1.2339 17.0682 1.20214 16.8918 1.30559C16.7197 1.40699 16.608 1.64358 16.608 1.64358C16.608 1.64358 16.1009 2.96993 15.4237 4.09862C13.9953 6.47888 13.4246 6.60486 13.1908 6.45738C12.6472 6.11222 12.7829 5.07264 12.7829 4.33418C12.7829 2.02664 13.1397 1.0649 12.089 0.816017C11.7405 0.733056 11.4838 0.678773 10.5917 0.669555C9.44705 0.658288 8.47877 0.673652 7.92993 0.936874C7.56474 1.11201 7.28301 1.50326 7.45518 1.5258C7.66699 1.55345 8.14696 1.6528 8.40155 1.99284C8.73023 2.43222 8.71875 3.41752 8.71875 3.41752C8.71875 3.41752 8.90761 6.13372 8.27739 6.47069C7.84541 6.70216 7.25275 6.23 5.97875 4.06994C5.32661 2.96379 4.83412 1.74088 4.83412 1.74088C4.83412 1.74088 4.73917 1.51248 4.56909 1.38958C4.36354 1.24106 4.0766 1.19498 4.0766 1.19498L1.02879 1.21444C1.02879 1.21444 0.57073 1.22673 0.40274 1.42235C0.253532 1.59544 0.391262 1.95494 0.391262 1.95494C0.391262 1.95494 2.77755 7.4355 5.47999 10.1978C7.9581 12.7296 10.7711 12.5637 10.7711 12.5637H12.0462Z" fill="#222222"/>
|
<path d="M12.0462 12.5637C12.0462 12.5637 12.4312 12.5217 12.6284 12.3138C12.8089 12.1233 12.8027 11.7638 12.8027 11.7638C12.8027 11.7638 12.7787 10.0851 13.5727 9.83727C14.3553 9.59351 15.3601 11.4606 16.4265 12.1786C17.232 12.7215 17.8434 12.6026 17.8434 12.6026L20.693 12.5637C20.693 12.5637 22.183 12.4736 21.4766 11.3234C21.4181 11.2292 21.0644 10.4723 19.3584 8.91753C17.5711 7.29006 17.8111 7.55328 19.9626 4.73772C21.2731 3.02319 21.7969 1.97645 21.6331 1.52887C21.4776 1.10075 20.5135 1.21444 20.5135 1.21444L17.3061 1.2339C17.3061 1.2339 17.0682 1.20214 16.8918 1.30559C16.7197 1.40699 16.608 1.64358 16.608 1.64358C16.608 1.64358 16.1009 2.96993 15.4237 4.09862C13.9953 6.47888 13.4246 6.60486 13.1908 6.45738C12.6472 6.11222 12.7829 5.07264 12.7829 4.33418C12.7829 2.02664 13.1397 1.0649 12.089 0.816017C11.7405 0.733056 11.4838 0.678773 10.5917 0.669555C9.44705 0.658288 8.47877 0.673652 7.92993 0.936874C7.56474 1.11201 7.28301 1.50326 7.45518 1.5258C7.66699 1.55345 8.14696 1.6528 8.40155 1.99284C8.73023 2.43222 8.71875 3.41752 8.71875 3.41752C8.71875 3.41752 8.90761 6.13372 8.27739 6.47069C7.84541 6.70216 7.25275 6.23 5.97875 4.06994C5.32661 2.96379 4.83412 1.74088 4.83412 1.74088C4.83412 1.74088 4.73917 1.51248 4.56909 1.38958C4.36354 1.24106 4.0766 1.19498 4.0766 1.19498L1.02879 1.21444C1.02879 1.21444 0.57073 1.22673 0.40274 1.42235C0.253532 1.59544 0.391262 1.95494 0.391262 1.95494C0.391262 1.95494 2.77755 7.4355 5.47999 10.1978C7.9581 12.7296 10.7711 12.5637 10.7711 12.5637H12.0462Z" fill="#5181B8"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -6,6 +6,14 @@
|
|||||||
line-height: 44px;
|
line-height: 44px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #072AC8;
|
||||||
|
}
|
||||||
|
|
||||||
@include mediaMax($tablet-max-width) {
|
@include mediaMax($tablet-max-width) {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
|||||||
@@ -10,6 +10,17 @@ import {
|
|||||||
transformPostsToCardData,
|
transformPostsToCardData,
|
||||||
} from "@/widgets/CardList/CardListFunctions";
|
} from "@/widgets/CardList/CardListFunctions";
|
||||||
import { usePostProjects } from "@/modules/posts/hooks/usePostProjects";
|
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 {
|
interface ListProps {
|
||||||
gridConfig?: GridConfig;
|
gridConfig?: GridConfig;
|
||||||
@@ -22,23 +33,30 @@ const NewsList = ({
|
|||||||
const { data: newsData, isLoading, isError } = useNews();
|
const { data: newsData, isLoading, isError } = useNews();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithLoading
|
<>
|
||||||
isLoading={isLoading}
|
<ScrollToTopOnMount />
|
||||||
isError={isError}
|
<WithLoading
|
||||||
count={4}
|
isLoading={isLoading}
|
||||||
gridConfig={gridConfig}
|
isError={isError}
|
||||||
>
|
count={4}
|
||||||
<div className={styles.mainContainer}>
|
gridConfig={gridConfig}
|
||||||
{newsData && (
|
>
|
||||||
<CardListTemplate
|
<div className={styles.mainContainer}>
|
||||||
items={transformNewsToCardData(newsData)}
|
{newsData && (
|
||||||
variant="news"
|
<CardListTemplate
|
||||||
gridConfig={gridConfig}
|
items={transformNewsToCardData(newsData)}
|
||||||
title="Новости"
|
variant="news"
|
||||||
/>
|
gridConfig={gridConfig}
|
||||||
)}
|
title={
|
||||||
</div>
|
<Link to="/news" className={styles.title} onClick={() => window.scrollTo(0, 0)}>
|
||||||
</WithLoading>
|
Новости
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</WithLoading>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,20 +67,27 @@ const LabsList = ({
|
|||||||
const labs = postsData?.labs ? Object.values(postsData.labs) : [];
|
const labs = postsData?.labs ? Object.values(postsData.labs) : [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithLoading
|
<>
|
||||||
isLoading={isLoading}
|
<ScrollToTopOnMount />
|
||||||
isError={isError}
|
<WithLoading
|
||||||
gridConfig={gridConfig}
|
isLoading={isLoading}
|
||||||
>
|
isError={isError}
|
||||||
<div className={styles.mainContainer}>
|
gridConfig={gridConfig}
|
||||||
<CardListTemplate
|
>
|
||||||
items={transformPostsToCardData(labs)}
|
<div className={styles.mainContainer}>
|
||||||
variant="lab"
|
<CardListTemplate
|
||||||
gridConfig={gridConfig}
|
items={transformPostsToCardData(labs)}
|
||||||
title="Наши лаборатории"
|
variant="lab"
|
||||||
/>
|
gridConfig={gridConfig}
|
||||||
</div>
|
title={
|
||||||
</WithLoading>
|
<Link to="/labs" className={styles.title} onClick={() => window.scrollTo(0, 0)}>
|
||||||
|
Наши лаборатории
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WithLoading>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,21 +99,27 @@ const ProjectsList = ({
|
|||||||
const projects = data ?? [];
|
const projects = data ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithLoading
|
<>
|
||||||
isLoading={isLoading}
|
<ScrollToTopOnMount />
|
||||||
isError={isError}
|
<WithLoading
|
||||||
gridConfig={gridConfig}
|
isLoading={isLoading}
|
||||||
>
|
isError={isError}
|
||||||
<div className={styles.mainContainer}>
|
gridConfig={gridConfig}
|
||||||
<CardListTemplate
|
>
|
||||||
//@ts-ignore
|
<div className={styles.mainContainer}>
|
||||||
items={transformPostsToCardData(projects)}
|
<CardListTemplate
|
||||||
variant="project"
|
items={transformPostsToCardData(projects)}
|
||||||
gridConfig={gridConfig}
|
variant="project"
|
||||||
title="Наши проекты"
|
gridConfig={gridConfig}
|
||||||
/>
|
title={
|
||||||
</div>
|
<Link to="/projects" className={styles.title} onClick={() => window.scrollTo(0, 0)}>
|
||||||
</WithLoading>
|
Наши проекты
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WithLoading>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const CardListTemplate = ({
|
|||||||
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
|
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
|
||||||
title = "Наши лаборатории",
|
title = "Наши лаборатории",
|
||||||
}: CardListProps) => {
|
}: CardListProps) => {
|
||||||
const itemsArray = Object.values(items);
|
const itemsArray = Object.values(items).reverse();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ export interface CardListProps {
|
|||||||
items: Record<string, CardData>; // Объект объектов
|
items: Record<string, CardData>; // Объект объектов
|
||||||
variant?: "lab" | "news" | "project";
|
variant?: "lab" | "news" | "project";
|
||||||
gridConfig?: GridConfig;
|
gridConfig?: GridConfig;
|
||||||
title: string;
|
title: string | React.ReactNode;
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__stage {
|
&__stage {
|
||||||
display: flex;
|
display: flex !important;
|
||||||
|
flex-wrap: nowrap;
|
||||||
gap: 32px;
|
gap: 32px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
&__stage-item {
|
&__stage-item {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
box-sizing: border-box;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +56,8 @@
|
|||||||
|
|
||||||
&__stage-item {
|
&__stage-item {
|
||||||
padding: 0 5%;
|
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;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import AliceCarousel from "react-alice-carousel";
|
import AliceCarousel from "react-alice-carousel";
|
||||||
import "react-alice-carousel/lib/alice-carousel.css";
|
import "react-alice-carousel/lib/alice-carousel.css";
|
||||||
|
|
||||||
@@ -10,13 +10,12 @@ import "./NewSlider.scss";
|
|||||||
import { SliderContext, SliderProps } from "@/widgets/NewSlider/context";
|
import { SliderContext, SliderProps } from "@/widgets/NewSlider/context";
|
||||||
|
|
||||||
function NewSlider({
|
function NewSlider({
|
||||||
autoPlay = false,
|
|
||||||
autoPlayTime = 3000,
|
|
||||||
images,
|
images,
|
||||||
category = "gallery",
|
category = "gallery",
|
||||||
}: SliderProps) {
|
}: SliderProps) {
|
||||||
const { data: mediaData, isLoading, isError } = useMedia();
|
const { data: mediaData, isLoading, isError } = useMedia();
|
||||||
const [slideNumber, setSlideNumber] = useState(0);
|
const [slideNumber, setSlideNumber] = useState(0);
|
||||||
|
const [windowWidth, setWindowWidth] = useState<number>(typeof window !== 'undefined' ? window.innerWidth : 1024);
|
||||||
|
|
||||||
const carouselRef = useRef<AliceCarousel | null>(null);
|
const carouselRef = useRef<AliceCarousel | null>(null);
|
||||||
|
|
||||||
@@ -24,16 +23,31 @@ function NewSlider({
|
|||||||
? 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 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 = {
|
const responsive = {
|
||||||
0: { items: 1 },
|
0: { items: 1 },
|
||||||
768: { items: 1 },
|
768: { items: 2 },
|
||||||
1024: { items: 5 },
|
1024: { items: shouldShowControls ? 5 : filteredMedia.length },
|
||||||
};
|
};
|
||||||
|
|
||||||
const items = filteredMedia.map((media, index) => (
|
const items = filteredMedia.map((media, index) => (
|
||||||
<div
|
<div
|
||||||
key={media.id ?? index}
|
key={media.id ?? index}
|
||||||
className={`slider-item ${filteredMedia.length === 1 ? "single" : ""}`}
|
className="slider-item"
|
||||||
|
style={{
|
||||||
|
width: '350px',
|
||||||
|
height: '350px',
|
||||||
|
margin: '0 auto',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={media.src}
|
src={media.src}
|
||||||
@@ -59,42 +73,47 @@ function NewSlider({
|
|||||||
|
|
||||||
if (isLoading) return <SkeletonSlider />;
|
if (isLoading) return <SkeletonSlider />;
|
||||||
if (isError) return <center>Ошибка при загрузке медиа</center>;
|
if (isError) return <center>Ошибка при загрузке медиа</center>;
|
||||||
if (filteredMedia.length === 0) return <div>Нет изображений для отображения</div>;
|
if (filteredMedia.length === 0) return <div>Нет изображений</div>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SliderContext.Provider
|
<SliderContext.Provider
|
||||||
value={{
|
value={{
|
||||||
slideNumber,
|
slideNumber,
|
||||||
mediaList: filteredMedia,
|
mediaList: filteredMedia,
|
||||||
goToSlide: setSlideNumber,
|
goToSlide: (index: number) => {
|
||||||
|
carouselRef.current?.slideTo(index);
|
||||||
|
setSlideNumber(index);
|
||||||
|
},
|
||||||
slidesCount: filteredMedia.length,
|
slidesCount: filteredMedia.length,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="slider-container">
|
<div className="slider-container">
|
||||||
<div className="sliderNav">
|
{shouldShowControls && (
|
||||||
<button className="sliderButton prev" onClick={slidePrev}>
|
<div className="sliderNav">
|
||||||
<img src={Vector} alt="Previous" />
|
<button className="sliderButton prev" onClick={slidePrev}>
|
||||||
</button>
|
<img src={Vector} alt="Previous" />
|
||||||
<button className="sliderButton" onClick={slideNext}>
|
</button>
|
||||||
<img src={Vector} alt="Next" />
|
<button className="sliderButton" onClick={slideNext}>
|
||||||
</button>
|
<img src={Vector} alt="Next" />
|
||||||
</div>
|
</button>
|
||||||
<div className="slider">
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className={`slider ${!shouldShowControls ? "centered" : ""}`}>
|
||||||
<AliceCarousel
|
<AliceCarousel
|
||||||
ref={carouselRef}
|
ref={carouselRef}
|
||||||
items={items}
|
items={items}
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
controlsStrategy="alternate"
|
autoPlay={false}
|
||||||
autoPlay={autoPlay}
|
infinite={shouldShowControls}
|
||||||
autoPlayInterval={autoPlayTime}
|
disableDotsControls
|
||||||
infinite={true}
|
disableButtonsControls
|
||||||
disableDotsControls={true}
|
mouseTracking={shouldShowControls}
|
||||||
disableButtonsControls={true}
|
touchTracking={shouldShowControls}
|
||||||
|
keyboardNavigation={shouldShowControls}
|
||||||
activeIndex={slideNumber}
|
activeIndex={slideNumber}
|
||||||
onSlideChanged={handleSlideChanged}
|
onSlideChanged={handleSlideChanged}
|
||||||
mouseTracking={true}
|
renderKey={filteredMedia.length}
|
||||||
touchTracking={true}
|
|
||||||
keyboardNavigation={true}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ const Numbers = () => {
|
|||||||
<label>выполненных проектов</label>
|
<label>выполненных проектов</label>
|
||||||
</div>
|
</div>
|
||||||
<div className='blocks'>
|
<div className='blocks'>
|
||||||
<p className="namber">{yearsSince2015}</p>
|
<p className="namber">50+</p>
|
||||||
<label>лет успешной работы</label>
|
<label>побед в конкурсах</label>
|
||||||
</div>
|
</div>
|
||||||
<div className='blocks'>
|
<div className='blocks'>
|
||||||
<p className="namber">20+</p>
|
<p className="namber">100+</p>
|
||||||
<label>сотрудников</label>
|
<label>обученных школьников</label>
|
||||||
</div>
|
</div>
|
||||||
<div className='blocks'>
|
<div className='blocks'>
|
||||||
<p className="namber">30+</p>
|
<p className="namber">500+</p>
|
||||||
<label>выполненных проектов</label>
|
<label>обученных студентов</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img className="visible" src={Illustration} alt="Illustration" />
|
<img className="visible" src={Illustration} alt="Illustration" />
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ $logo-size: 200px;
|
|||||||
.logo {
|
.logo {
|
||||||
width: $logo-size;
|
width: $logo-size;
|
||||||
height: $logo-size;
|
height: $logo-size;
|
||||||
border-radius: 50%;
|
//border-radius: 50%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
.swiper-slide.single {
|
.swiper-slide.single {
|
||||||
.slide-image {
|
.slide-image {
|
||||||
width: auto;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ $swiper-button-arrow-size: 20px;
|
|||||||
.header {
|
.header {
|
||||||
//text-align: center;
|
//text-align: center;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
|
&.header--center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-block-columns {
|
.wp-block-columns {
|
||||||
@@ -203,3 +206,28 @@ $swiper-button-arrow-size: 20px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ export default function WpPost({
|
|||||||
customComponent
|
customComponent
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<PageHeader className="header">
|
<PageHeader className={`header ${isSpecialTitle ? "header--center" : ""}`}>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
{Array.isArray(post.content) &&
|
{Array.isArray(post.content) &&
|
||||||
|
|||||||
Reference in new issue
Block a user