mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 03:29:45 +00:00
перенес структуру Севы со своими правками
This commit is contained in:
1 parent
3a1cac0dfe
commit
808d97eb4b
331 files changed
+12260
-19950
No files matched your search
-276
@@ -1,276 +0,0 @@
|
||||
import * as WPAPI from 'wpapi';
|
||||
import { flatten } from 'lodash';
|
||||
|
||||
import reactPress from './reactPress';
|
||||
import Parse from 'html-react-parser';
|
||||
|
||||
const wp = new WPAPI(
|
||||
process.env.NODE_ENV === 'development'
|
||||
? {
|
||||
endpoint: reactPress.api.rest_url,
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
}
|
||||
: { endpoint: reactPress.api.rest_url, nonce: reactPress.api.nonce }
|
||||
);
|
||||
|
||||
const skbEndpoint = `${wp._options.endpoint}skbkit/v1`;
|
||||
|
||||
function parseContent(str) {
|
||||
if (typeof str !== 'string') return str;
|
||||
const content = Parse(str);
|
||||
|
||||
let result = [];
|
||||
let temp = [];
|
||||
|
||||
for (let i = 0; i < content.length; i++) {
|
||||
const current = content[i];
|
||||
|
||||
if (typeof current === 'string') continue;
|
||||
|
||||
const currentElClasses = current.props.className;
|
||||
|
||||
if (current.type === "figure" && currentElClasses.includes('wp-block-image')) {
|
||||
temp.push(current.props.children.props.src); // Добавляем элемент в temp
|
||||
} else {
|
||||
if (temp.length !== 0) {
|
||||
result.push({ type: "mediablock", value: temp });
|
||||
temp = []; // Очищаем временный массив
|
||||
}
|
||||
|
||||
result.push(current); // Добавляем текущий элемент в результат
|
||||
}
|
||||
}
|
||||
|
||||
if (temp.length !== 0) {
|
||||
result.push({ type: "mediablock", value: temp });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async function getAllContent(request) {
|
||||
return request.then(function (response) {
|
||||
if (!response._paging || !response._paging.next) {
|
||||
return response;
|
||||
}
|
||||
// Запрос к следующей странице и возврат ответов одной коллекцией
|
||||
return Promise.all([
|
||||
response,
|
||||
getAllContent(response._paging.next)
|
||||
]).then(function (responses) {
|
||||
return flatten(responses);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Функция загрузки медиабиблиотеки и сортировки по категориям
|
||||
async function loadMedia() {
|
||||
const response = await getAllContent(wp.media());
|
||||
|
||||
// Нам потребуется id, категория и url
|
||||
const result = [];
|
||||
|
||||
for (let { id, source_url: src, alt_text } of response) {
|
||||
const [category, name] = alt_text.split('_');
|
||||
// Добавляем медиа в массив нужной категории
|
||||
result.push({ id, src, category, name });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const mediaLibrary = await loadMedia();
|
||||
console.log('mediaLibrary', mediaLibrary);
|
||||
|
||||
async function loadPosts() {
|
||||
// Получаем рубрики
|
||||
const responseCategories = await getAllContent(wp.categories());
|
||||
const categories = {};
|
||||
|
||||
for (let { id, name } of responseCategories) {
|
||||
categories[id] = name;
|
||||
}
|
||||
|
||||
// Получаем метки
|
||||
const responseTags = await getAllContent(wp.tags());
|
||||
const tags = {};
|
||||
|
||||
for (let { id, name } of responseTags) {
|
||||
tags[id] = name;
|
||||
}
|
||||
|
||||
// Получаем записи
|
||||
const responsePosts = await getAllContent(wp.posts());
|
||||
|
||||
// К проектам и лабораториям обращение по id, поэтому для быстроты чтения они - объекты
|
||||
// Остальные посты (other) ищутся по категориям, это проще делать по массиву
|
||||
const result = {
|
||||
projects: {},
|
||||
labs: {},
|
||||
other: [],
|
||||
}
|
||||
|
||||
for (let post of responsePosts) {
|
||||
const image = mediaLibrary.find(item => item.id === post.featured_media);
|
||||
const newPost = {
|
||||
id: post.id,
|
||||
name: post.title.rendered,
|
||||
categories: post.categories.map(el => categories[el]),
|
||||
tag: post.tags.map(el => tags[el])[0],
|
||||
content: parseContent(post.content.rendered),
|
||||
preview: image ? image.src : null,
|
||||
lab: null,
|
||||
}
|
||||
|
||||
if (newPost.categories.includes('projects')) {
|
||||
newPost.lab = newPost.categories.filter(el => el !== 'projects')[0];
|
||||
result.projects[post.id] = newPost;
|
||||
} else if (newPost.categories.includes('labs')) {
|
||||
newPost.previewText = Parse(post.excerpt.rendered)[0].props.children;
|
||||
result.labs[post.id] = newPost;
|
||||
} else {
|
||||
result.other.push(newPost);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
const posts = await loadPosts();
|
||||
console.log('posts', posts);
|
||||
|
||||
export async function getPosts(category) {
|
||||
try {
|
||||
if (category) {
|
||||
return posts.other.filter(post => post.categories.includes(category));
|
||||
}
|
||||
|
||||
return posts;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMedia(category, target = false) {
|
||||
try {
|
||||
const mediaFiltered = mediaLibrary.filter(el => el.category === category);
|
||||
|
||||
if (target) {
|
||||
for (let media of mediaFiltered) {
|
||||
target[media.name].src = media.src;
|
||||
target[media.name].id = media.id;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
return mediaFiltered;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getProjectByID(id) {
|
||||
try {
|
||||
if (typeof id != 'undefined') {
|
||||
return posts.projects[id];
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getProjects(lab) {
|
||||
try {
|
||||
if (typeof lab != 'undefined') {
|
||||
return Object.values(posts.projects).filter(project => project.lab === lab);
|
||||
}
|
||||
|
||||
return posts.projects;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLabByID(id) {
|
||||
try {
|
||||
if (typeof id != 'undefined') {
|
||||
return posts.labs[id];
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLabs() {
|
||||
try {
|
||||
return posts.labs;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export const vkWallUrl = 'https://vk.com/skbkit?w=wall-172789021';
|
||||
|
||||
export async function getNews(count = 0, offset = 0) {
|
||||
try {
|
||||
const response = await fetch(`${skbEndpoint}/getnews?count=${count}&offset=${offset}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Ошибка сети', response);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Получения новостей (api):', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getNewsByID(newsID) {
|
||||
try {
|
||||
const response = await fetch(`${skbEndpoint}/getnewsbyid?id=${newsID}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Ошибка сети', response);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Получения новостей (api):', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendContactForm(formData) {
|
||||
console.log('Форма отправляется');
|
||||
for (let el of formData.entries()) {
|
||||
console.log(el[0] + ': ' + el[1]);
|
||||
}
|
||||
try {
|
||||
const response = await fetch(`${skbEndpoint}/sendcontactform`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Ошибка сети', response);
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error('Ошибка отправки формы (api):', error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import "./styles/App.scss";
|
||||
|
||||
import { Suspense } from "react";
|
||||
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
import { classNames } from "@/shared/lib/classNames/classNames";
|
||||
import { RouterProvider } from "react-router-dom";
|
||||
import { appRouter } from "@/app/providers/router";
|
||||
|
||||
function App() {
|
||||
// Создаём экземпляр QueryClient
|
||||
const queryClient = new QueryClient();
|
||||
return (
|
||||
<>
|
||||
<div className={classNames("app", {}, [])}>
|
||||
<Suspense fallback="loading">
|
||||
<div className="content-page">
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<RouterProvider router={appRouter} />
|
||||
</QueryClientProvider>
|
||||
</div>
|
||||
</Suspense>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,161 @@
|
||||
// Общий стиль
|
||||
#root {
|
||||
position: relative; // Убедитесь, что #root имеет relative
|
||||
background-repeat: no-repeat;
|
||||
background-position: center bottom;
|
||||
background-image: url("/assets/images/backround/bg_footer_02.svg");
|
||||
background-size: 100% auto;
|
||||
z-index: 0; // Задний план
|
||||
opacity: 0; // Сделаем #root видимым сразу
|
||||
min-height: 100vh; // Устанавливаем минимальную высоту для #root
|
||||
|
||||
// Псевдоэлемент для фона в верхней части страницы
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 160px;
|
||||
left: 0; // Слева
|
||||
width: 100%; // На всю ширину
|
||||
height: 364px; // Ограничиваем максимальную высоту
|
||||
background-image: url("../../assets/images/backround/bg_news_block.svg"); // Картинка
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
background-size: contain;
|
||||
z-index: -1; // Картинка на заднем плане, за остальными элементами
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: none; // Прячем картинку на мобильных устройствах
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Для главной страницы
|
||||
#root:has(> #react-page #mainpageheader) {
|
||||
background-image: url("/assets/images/backround/bg_footer.svg");
|
||||
&::before {
|
||||
background-image: none;
|
||||
}
|
||||
}
|
||||
#react-page:has(> #mainpageheader) {
|
||||
margin-top: 0;
|
||||
}
|
||||
.page-loaded #root {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#react-page {
|
||||
margin-top: calc($navbar-height + 5 * $navbar-padding-tb);
|
||||
|
||||
.header,
|
||||
.content {
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
background: $bg-primary;
|
||||
//padding: 0 1em;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
//box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.block .heading a,
|
||||
#navbar .nav-link {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.block .heading a::after,
|
||||
#navbar .nav-link::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 0;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 1px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.block .heading a::after {
|
||||
background: $text-primary;
|
||||
}
|
||||
|
||||
.block .heading a:hover:after,
|
||||
#navbar .nav-link:hover:after,
|
||||
#navbar .nav-link.active:after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.scroll-to-top {
|
||||
position: fixed;
|
||||
right: 2vw; // Используем vw для адаптивности
|
||||
bottom: 7.5vh; // Используем vh для адаптивности
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
width: 61px;
|
||||
height: 61px;
|
||||
z-index: 10;
|
||||
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
animation: scaleIn 0.5s forwards; /* Анимация появления */
|
||||
box-shadow: 5px 6px 15px rgba(0, 0, 0, 0.05);
|
||||
&.visible {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
box-shadow: 5px 6px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
animation: scaleOut 0.5s forwards; /* Анимация исчезновения */
|
||||
}
|
||||
|
||||
img {
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Анимация для появления кнопки */
|
||||
@keyframes scaleIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Анимация для исчезновения кнопки */
|
||||
@keyframes scaleOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scroll-to-top {
|
||||
display: none; // Скрыть кнопку на мобильных устройствах
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { Outlet, useLocation } from "react-router-dom";
|
||||
import { createContext, useEffect, useState } from "react";
|
||||
|
||||
import "./Root.styles.scss";
|
||||
|
||||
import up from "@/shared/assets/images/up.svg";
|
||||
import useElementOnScreen from "@/shared/lib/ElementOnScreen/ElementOnScreen";
|
||||
import Navbar from "@/widgets/Navbar";
|
||||
import Footer from "@/widgets/Footer";
|
||||
|
||||
// Тип для контекста
|
||||
interface RootContextType {
|
||||
setRef: (element: HTMLElement | null) => void;
|
||||
}
|
||||
|
||||
// Создаем контекст с типом
|
||||
export const RootContext = createContext<RootContextType>({ setRef: () => {} });
|
||||
|
||||
function Root() {
|
||||
const location = useLocation(); // Хук для получения текущего пути
|
||||
const [setRef, isTargetVisible] = useElementOnScreen({
|
||||
root: null,
|
||||
rootMargin: "0px",
|
||||
threshold: 0.9,
|
||||
});
|
||||
|
||||
const [isOnTopVisible, setIsOnTopVisible] = useState<boolean>(false); // Состояние для видимости кнопки
|
||||
const [hasScrolled, setHasScrolled] = useState<boolean>(false); // Флаг для отслеживания прокрутки
|
||||
|
||||
// Для навбара
|
||||
useEffect(() => {
|
||||
const navbar = document.getElementById("navbar");
|
||||
if (navbar) {
|
||||
if (isTargetVisible) {
|
||||
navbar.classList.add("transparent");
|
||||
} else {
|
||||
navbar.classList.remove("transparent");
|
||||
}
|
||||
}
|
||||
}, [isTargetVisible]);
|
||||
|
||||
// Для кнопки OnTop
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
document.body.classList.add("page-loaded");
|
||||
}, 100); // Небольшая задержка, чтобы избежать мерцания
|
||||
|
||||
const handleScroll = () => {
|
||||
const headerHeight =
|
||||
document.getElementById("mainpageheader")?.offsetHeight || 0;
|
||||
if (window.scrollY > headerHeight && !hasScrolled) {
|
||||
setHasScrolled(true);
|
||||
}
|
||||
setIsOnTopVisible(window.scrollY > headerHeight); // Показываем кнопку
|
||||
};
|
||||
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => {
|
||||
window.removeEventListener("scroll", handleScroll);
|
||||
};
|
||||
}, [hasScrolled]);
|
||||
|
||||
// Ускоренный плавный скролл вверх
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
};
|
||||
|
||||
// Определяем, находимся ли мы на главной странице
|
||||
const isHomePage = location.pathname === "/";
|
||||
|
||||
return (
|
||||
<RootContext.Provider value={{ setRef }}>
|
||||
<Navbar />
|
||||
<div
|
||||
id="react-page"
|
||||
style={{ marginTop: isHomePage ? "0px" : "" }} // Устанавливаем margin-top
|
||||
>
|
||||
<Outlet />
|
||||
</div>
|
||||
<Footer />
|
||||
{hasScrolled && (
|
||||
<button
|
||||
className={`scroll-to-top ${isOnTopVisible ? "visible" : "hidden"}`}
|
||||
onClick={scrollToTop}
|
||||
>
|
||||
<img src={up} alt="Scroll to top" />
|
||||
</button>
|
||||
)}
|
||||
</RootContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export default Root;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { appRouter } from "./ui/AppRouter";
|
||||
|
||||
export { appRouter };
|
||||
@@ -0,0 +1,14 @@
|
||||
import Root from "@/app/Layout/Root";
|
||||
import { routeConfig } from "@/shared/config/routeConfig/routeConfig";
|
||||
import { createBrowserRouter } from "react-router-dom";
|
||||
|
||||
export const appRouter = createBrowserRouter([
|
||||
{
|
||||
element: <Root />,
|
||||
|
||||
children: Object.values(routeConfig).map((route) => ({
|
||||
path: route.path,
|
||||
element: route.element,
|
||||
})),
|
||||
},
|
||||
]);
|
||||
@@ -0,0 +1,86 @@
|
||||
@import "bootstrap/scss/bootstrap";
|
||||
@import "global";
|
||||
@import "variables/variables";
|
||||
@import "reset";
|
||||
|
||||
@font-face {
|
||||
font-family: "Montserrat";
|
||||
font-style: normal;
|
||||
font-weight: 100 900;
|
||||
font-display: swap;
|
||||
src: url("../fonts/Montserrat/Montserrat-VariableFont_wght.ttf")
|
||||
format("truetype");
|
||||
}
|
||||
.app {
|
||||
min-height: 100%;
|
||||
}
|
||||
#page {
|
||||
> #header,
|
||||
> hr,
|
||||
> #footer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.mainContainer {
|
||||
margin: 0 10%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
margin-bottom: 30px;
|
||||
@include mediaMax($mobile-xs-width) {
|
||||
margin: 0 5%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
}
|
||||
.loader {
|
||||
width: 336px; /* 48px * 7 */
|
||||
height: 280px; /* 40px * 7 */
|
||||
margin-top: 210px; /* 30px * 7 */
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
background: #6ebeff;
|
||||
border-radius: 15% 15% 35% 35%;
|
||||
}
|
||||
|
||||
.loader::after {
|
||||
content: "";
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 315px; /* 45px * 7 */
|
||||
top: 56px; /* 8px * 7 */
|
||||
border: 28px solid #6ebeff; /* 4px * 7 */
|
||||
width: 112px; /* 16px * 7 */
|
||||
height: 140px; /* 20px * 7 */
|
||||
border-radius: 0 28px 28px 0; /* 4px * 7 */
|
||||
}
|
||||
|
||||
.loader::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 7px; /* 1px * 7 */
|
||||
height: 70px; /* 10px * 7 */
|
||||
color: #6ebeff;
|
||||
top: -105px; /* -15px * 7 */
|
||||
left: 77px; /* 11px * 7 */
|
||||
box-sizing: border-box;
|
||||
animation: animloader 1s ease infinite;
|
||||
}
|
||||
|
||||
@keyframes animloader {
|
||||
0% {
|
||||
box-shadow: 14px 0px rgba(51, 122, 183, 0),
|
||||
/* 2px * 7 */ 84px 0px rgba(51, 122, 183, 0.3),
|
||||
/* 12px * 7 */ 140px 0px rgba(51, 122, 183, 0); /* 20px * 7 */
|
||||
}
|
||||
50% {
|
||||
box-shadow: 14px -35px rgba(51, 122, 183, 0.5),
|
||||
/* 2px * 7, -5px * 7 */ 84px -21px rgba(51, 122, 183, 0.5),
|
||||
/* 12px * 7, -3px * 7 */ 140px -14px rgba(51, 122, 183, 0.6); /* 20px * 7, -2px * 7 */
|
||||
}
|
||||
100% {
|
||||
box-shadow: 14px -56px rgba(51, 122, 183, 0),
|
||||
/* 2px * 7, -8px * 7 */ 84px -35px rgba(51, 122, 183, 0),
|
||||
/* 12px * 7, -5px * 7 */ 140px -35px rgba(51, 122, 183, 0); /* 20px * 7, -5px * 7 */
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,3 @@
|
||||
@import "./theme.scss";
|
||||
@import "./fonts.scss";
|
||||
@import "./wp-disable.scss";
|
||||
|
||||
input {
|
||||
border: none;
|
||||
}
|
||||
@@ -24,7 +20,7 @@ button {
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
}
|
||||
|
||||
@@ -47,7 +43,7 @@ a {
|
||||
color: $btn-primary-text;
|
||||
background: $btn-primary-bg;
|
||||
background-size: 200%;
|
||||
transition: .5s;
|
||||
transition: 0.5s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -68,7 +64,9 @@ a {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
p,
|
||||
ul,
|
||||
ol {
|
||||
// TODO: заменить переменной
|
||||
@media (max-width: 768px) {
|
||||
font-size: 16px;
|
||||
@@ -79,7 +77,8 @@ p, ul, ol {
|
||||
line-height: $main-line-height;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
ul,
|
||||
ol {
|
||||
margin-top: -0.75em;
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ header h1 {
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
line-height: 44px;
|
||||
margin-top: 0;
|
||||
margin-top: 24px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
margin-top: 0;
|
||||
@@ -108,4 +107,14 @@ header h1 {
|
||||
#footer {
|
||||
margin-top: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
dl,
|
||||
ol,
|
||||
ul {
|
||||
margin-bottom: 1rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
textarea,
|
||||
select {
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
}
|
||||
body {
|
||||
font-family: "Montserrat", sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//Цвета
|
||||
$bg-primary: white;
|
||||
$bg-secondary: #343434;
|
||||
$bg-footer: #222222;
|
||||
$bg-form: #f5f5f7;
|
||||
$bg-card-lab: black;
|
||||
$bg-image: rgba(0, 0, 0, 0.75);
|
||||
|
||||
$text-primary: black;
|
||||
$text-secondary: white;
|
||||
$text-card-project: white;
|
||||
$text-card-project-bg: rgba(255, 255, 255, 0.75);
|
||||
|
||||
$shadow-primary: rgba(0, 0, 0, 0.25);
|
||||
|
||||
$btn-primary-text: white;
|
||||
$btn-primary-bg: linear-gradient(
|
||||
93.25deg,
|
||||
#4942e4 0%,
|
||||
#11009e 50%,
|
||||
#4942e4 100%
|
||||
),
|
||||
linear-gradient(0deg, #585858, #585858);
|
||||
|
||||
// Размеры
|
||||
$navbar-height: 60px;
|
||||
$navbar-height-mini: 30px;
|
||||
$navbar-padding-tb: 10px;
|
||||
$navbar-logo-height: 247px;
|
||||
$navbar-logo-mini-height: 165px;
|
||||
|
||||
$row-gap: 26px;
|
||||
|
||||
$main-font-size: 20px;
|
||||
$main-font-weight: 400;
|
||||
$main-line-height: 30px;
|
||||
|
||||
//Разрешения
|
||||
$desktop-4k-width: 2560px;
|
||||
$maxDesktopWidth: 2800px;
|
||||
$desktop-hd: 1920px;
|
||||
$desktop-bootstrap: 100000px;
|
||||
$desktop-max-width: 1441.98px;
|
||||
$desktop-max-width-sec: 1400.98px;
|
||||
$desktop-small-width: 1200.98px;
|
||||
$small-tablet-max-width: 993.98px;
|
||||
// $small-tablet-max-width-exception: 992px;
|
||||
$tablet-max-width: 767.98px;
|
||||
$tablet-max-width-exception: 767.98px;
|
||||
$mobile-max-widthGosBlock: 531.98px;
|
||||
$mobile-max-width: 500.98px;
|
||||
$mobile-max-width-small: 425.98px;
|
||||
$mobile-max-width-superSmall: 390.98px;
|
||||
$mobile-extra-small-width: 375.98px;
|
||||
$img-mobile-max-width: 580.98px;
|
||||
|
||||
$mobile-xs-width: 576.98px;
|
||||
$mobile-xs-exception-absolute: 572px;
|
||||
@@ -0,0 +1,97 @@
|
||||
@mixin list-reset() {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@mixin margin-padding-reset() {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@mixin button-reset() {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@mixin scrollbar() {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #e4e5e8;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: rem(3);
|
||||
height: rem(3);
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: transparent;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background-color: #e4e5e8;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin flexbox($direction, $justify, $align) {
|
||||
display: flex;
|
||||
flex-direction: $direction;
|
||||
justify-content: $justify;
|
||||
align-items: $align;
|
||||
}
|
||||
|
||||
@mixin scrollBar(
|
||||
$color-track,
|
||||
$color-thumb,
|
||||
$width: rem(10),
|
||||
$height: rem(10)
|
||||
) {
|
||||
// firefox
|
||||
scrollbar-width: thin; /* "auto" или "thin" */
|
||||
scrollbar-color: $color-track $color-thumb;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: $width; /* ширина scrollbar */
|
||||
height: $height;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: $color-track; /* цвет дорожки */
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: $color-thumb; /* цвет плашки */
|
||||
border: 0 solid #fff; /* padding вокруг плашки */
|
||||
}
|
||||
}
|
||||
|
||||
@mixin mediaMax($mediaWidth) {
|
||||
@media only screen and (max-width: $mediaWidth - 1) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin mediaMin($mediaWidth) {
|
||||
@media only screen and (min-width: $mediaWidth) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin mediaDistance($mediaWidthMin, $mediaWidthMax) {
|
||||
@media only screen and (min-width: $mediaWidthMin) and (max-width: ($mediaWidthMax - 1)) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin isLoading(
|
||||
$duration: 0s,
|
||||
$bgc: #dedede,
|
||||
$gradientFirst: #f1f1f1,
|
||||
$gradientSecond: #d5d5d5
|
||||
) {
|
||||
background: $bgc;
|
||||
background: linear-gradient(
|
||||
110deg,
|
||||
$gradientSecond 8%,
|
||||
$gradientFirst 18%,
|
||||
$gradientSecond 33%
|
||||
);
|
||||
background-size: 200% 100%;
|
||||
animation: 1.5s shine $duration linear infinite;
|
||||
}
|
||||
File renamed without changes.
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB |
@@ -1,7 +0,0 @@
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 100 900;
|
||||
font-display: swap;
|
||||
src: url('../fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
//Цвета
|
||||
$bg-primary: white;
|
||||
$bg-secondary: #343434;
|
||||
$bg-footer: #222222;
|
||||
$bg-form: #F5F5F7;
|
||||
$bg-card-lab: black;
|
||||
$bg-image: rgba(0, 0, 0, .25);
|
||||
|
||||
$text-primary: black;
|
||||
$text-secondary: white;
|
||||
$text-card-project: white;
|
||||
$text-card-project-bg: rgba(255, 255, 255, 0.75);
|
||||
|
||||
$shadow-primary: rgba(0, 0, 0, 0.25);
|
||||
|
||||
$btn-primary-text: white;
|
||||
$btn-primary-bg: linear-gradient(93.25deg, #4942E4 0%, #11009E 50%, #4942E4 100%), linear-gradient(0deg, #585858, #585858);
|
||||
|
||||
// Размеры
|
||||
$navbar-height: 60px;
|
||||
$navbar-height-mini: 30px;
|
||||
$navbar-padding-tb: 10px;
|
||||
$navbar-logo-height: 247px;
|
||||
$navbar-logo-mini-height: 165px;
|
||||
|
||||
|
||||
$row-gap: 26px;
|
||||
|
||||
$main-font-size: 20px;
|
||||
$main-font-weight: 400;
|
||||
$main-line-height: 30px;
|
||||
@@ -1,7 +0,0 @@
|
||||
#page {
|
||||
> #header,
|
||||
> hr,
|
||||
> #footer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { Form } from "react-router-dom";
|
||||
import { SmartCaptcha } from "@yandex/smart-captcha";
|
||||
|
||||
import { sendContactForm } from "../../api";
|
||||
import Field from "../Field";
|
||||
import "./ContactForm.styles.scss";
|
||||
|
||||
|
||||
function ContactForm() {
|
||||
const [formData, setFormData] = useState({
|
||||
name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
message: '',
|
||||
file: null,
|
||||
captcha: '',
|
||||
agree: false,
|
||||
});
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
const handleChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData({ ...formData, [name]: value });
|
||||
};
|
||||
|
||||
const handlePhoneChange = (e) => {
|
||||
let value = e.target.value.replace(/\D/g, '');
|
||||
|
||||
if (value.length === 0 || value === '7') {
|
||||
setFormData({ ...formData, phone: '' });
|
||||
return;
|
||||
}
|
||||
|
||||
//+7 (XXX) XXX-XX-XX
|
||||
if (value.length === 1) {
|
||||
value = `+7 ${value}`;
|
||||
} else if (value.length <= 4) {
|
||||
value = `+7 (${value.slice(1)}`;
|
||||
} else if (value.length <= 7) {
|
||||
value = `+7 (${value.slice(1, 4)}) ${value.slice(4)}`;
|
||||
} else if (value.length <= 9) {
|
||||
value = `+7 (${value.slice(1, 4)}) ${value.slice(4, 7)}-${value.slice(7)}`;
|
||||
} else {
|
||||
value = `+7 (${value.slice(1, 4)}) ${value.slice(4, 7)}-${value.slice(7, 9)}-${value.slice(9, 11)}`;
|
||||
}
|
||||
|
||||
setFormData({ ...formData, phone: value });
|
||||
};
|
||||
|
||||
|
||||
const mb = 10;
|
||||
const MAX_FILE_SIZE = mb * 1024 * 1024; // Переменная для проверки размера. НЕ МЕНЯТЬ
|
||||
|
||||
const handleFileChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
// Проверка размера
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
alert(`Превышено ограничение размера файла (10 Мб)`);
|
||||
return;
|
||||
}
|
||||
// Проверка расширения
|
||||
const extension = file.name.match(/\.([^.]+)$/)[1];
|
||||
switch (extension) {
|
||||
case 'doc':
|
||||
case 'docx':
|
||||
case 'pdf':
|
||||
case 'txt':
|
||||
case 'pptx':
|
||||
case 'ppt':
|
||||
setFormData({ ...formData, file: e.target.files[0] });
|
||||
break;
|
||||
default:
|
||||
alert('Неверный формат файла.');
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveFile = () => {
|
||||
setFormData({ ...formData, file: null });
|
||||
};
|
||||
|
||||
const handleCaptchaChange = (token) => {
|
||||
setFormData({ ...formData, captcha: token });
|
||||
console.log('Капча пришла');
|
||||
};
|
||||
|
||||
const handleTokenExpired = useCallback(() => {
|
||||
setFormData({ ...formData, captcha: null });
|
||||
console.log('Капча просрочилась');
|
||||
}, []);
|
||||
|
||||
const handleAgreeChange = () => {
|
||||
setFormData({ ...formData, agree: !formData.agree });
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
if (!formData.agree) {
|
||||
alert('Вы должны согласиться с обработкой персональных данных.');
|
||||
return;
|
||||
}
|
||||
setIsSubmitting(true);
|
||||
console.log('handleSubmit isSubmitting: ', isSubmitting);
|
||||
|
||||
const formDataObj = new FormData();
|
||||
formDataObj.append('name', formData.name);
|
||||
formDataObj.append('email', formData.email);
|
||||
formDataObj.append('phone', formData.phone);//
|
||||
formDataObj.append('message', formData.message);
|
||||
formDataObj.append('file', formData.file);
|
||||
formDataObj.append('captcha', formData.captcha);
|
||||
|
||||
try {
|
||||
const response = await sendContactForm(formDataObj);
|
||||
if (response) {
|
||||
alert('Сообщение отправлено!');
|
||||
console.log('response', response);
|
||||
} else {
|
||||
alert('Ошибка отправки.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Ошибка:', error);
|
||||
alert('Ошибка отправки.');
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Form method="post" onSubmit={handleSubmit} className="half contact-form">
|
||||
<h2>Свяжитесь с нами!</h2>
|
||||
<div className="inputs">
|
||||
<Field
|
||||
key={1}
|
||||
type="text"
|
||||
name="name"
|
||||
placeholder="Имя"
|
||||
value={formData.name}
|
||||
onChange={handleChange}
|
||||
required
|
||||
isDisabled={isSubmitting}
|
||||
/>
|
||||
<Field
|
||||
key={2}
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="E-mail"
|
||||
value={formData.email}
|
||||
onChange={handleChange}
|
||||
required
|
||||
isDisabled={isSubmitting}
|
||||
/>
|
||||
<Field
|
||||
key={7}
|
||||
type="tel"
|
||||
name="phone"
|
||||
placeholder="+7 (___) ___-__-__"
|
||||
value={formData.phone}
|
||||
onChange={handlePhoneChange}
|
||||
pattern="\+7\s?\(?\d{3}\)?\s?\d{3}[-.\s]?\d{2}[-.\s]?\d{2}"
|
||||
required
|
||||
isDisabled={isSubmitting}
|
||||
/>
|
||||
<Field
|
||||
key={3}
|
||||
type="textarea"
|
||||
name="message"
|
||||
placeholder="Опишите в этом поле свой проект и, по возможности, прикрепите файл с ТЗ"
|
||||
value={formData.message}
|
||||
onChange={handleChange}
|
||||
required
|
||||
isDisabled={isSubmitting}
|
||||
/>
|
||||
<Field
|
||||
key={4}
|
||||
type="file"
|
||||
name="file"
|
||||
onChange={handleFileChange}
|
||||
handleRemoveFile={handleRemoveFile}
|
||||
fileAttached={formData && formData.file ? true : false}
|
||||
isDisabled={isSubmitting}
|
||||
/>
|
||||
<div className="checkbox-container">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="agree"
|
||||
name="agree"
|
||||
checked={formData.agree}
|
||||
onChange={handleAgreeChange}
|
||||
required
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<label htmlFor="agree">
|
||||
Я согласен с <a href="https://www.study.sfedu.ru/privacypolicy?ysclid=m8anp507sz44008873" target="_blank" rel="noopener noreferrer">обработкой персональных данных</a>
|
||||
</label>
|
||||
</div>
|
||||
<div className="submit-container">
|
||||
{formData.captcha &&
|
||||
<Field
|
||||
key={5}
|
||||
type="submit"
|
||||
value={isSubmitting ? 'Отправляется' : 'Отправить'}
|
||||
isDisabled={isSubmitting || !formData.agree}
|
||||
/>
|
||||
}
|
||||
<div
|
||||
className="captcha-container"
|
||||
style={formData.captcha ? { display: 'none' } : { display: 'block' }}
|
||||
>
|
||||
<SmartCaptcha
|
||||
key={6}
|
||||
sitekey="ysc1_8nFqhYasby2fJ9J7pCTxdBMe0Xc3Y6CrWk4aylB03d4f0045"
|
||||
onSuccess={handleCaptchaChange}
|
||||
onTokenExpired={handleTokenExpired}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
export default ContactForm;
|
||||
@@ -1,145 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
$gap: 20px;
|
||||
$icon-size: 24px;
|
||||
$color-file-button: rgb(7, 42, 200);
|
||||
|
||||
.contact-form {
|
||||
padding: 1.3rem 22px;
|
||||
border-radius: 16px;
|
||||
height: 100%;
|
||||
background-color: $bg-form;
|
||||
align-items: flex-start;
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
|
||||
font-size: 28px;
|
||||
font-weight: 500;
|
||||
line-height: 44px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.inputs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $gap;
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*:disabled {
|
||||
background: dimgrey;
|
||||
}
|
||||
|
||||
.field {
|
||||
padding: 12px 16px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.field.big {
|
||||
height: 300px;
|
||||
line-height: 30px;
|
||||
resize: none;
|
||||
@media (max-width: 768px) {
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.file-input-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.file-input {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
color: $color-file-button;
|
||||
font-weight: 500;
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.upload-file-btn {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
filter: invert(15%) sepia(100%) saturate(2861%) hue-rotate(229deg) brightness(93%) contrast(120%);
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
@media (max-width: 768px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-right: 6px;
|
||||
height: $icon-size;
|
||||
width: $icon-size;
|
||||
}
|
||||
|
||||
.remove-btn {
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
.icon.remove {
|
||||
margin-left: 6px;
|
||||
filter: hue-rotate(0) !important;
|
||||
height: calc($icon-size * 0.75);
|
||||
width: calc($icon-size * 0.75);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.file-input input:focus+.upload-file-btn {
|
||||
outline: -webkit-focus-ring-color auto 1px;
|
||||
}
|
||||
|
||||
.submit-container {
|
||||
.submit {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
|
||||
padding: 12px;
|
||||
font-size: 18px;
|
||||
line-height: normal;
|
||||
|
||||
&:disabled {
|
||||
background-color: #aaaaaa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-container {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import "./Field.styles.scss";
|
||||
import { fileUpload, cross } from "../../assets/images";
|
||||
|
||||
function Field({ type, name, placeholder, value, onChange, isDisabled = false, fileAttached = false, handleRemoveFile = null }) {
|
||||
const className = type === "submit" ? "submit btn"
|
||||
: type === "textarea" ? "field big"
|
||||
: "field";
|
||||
|
||||
return (
|
||||
<>
|
||||
{type === "textarea" ? (
|
||||
<textarea
|
||||
className={className}
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
required
|
||||
disabled={isDisabled}
|
||||
/>
|
||||
) : type === "file" ? (
|
||||
<div className="file-input-container">
|
||||
<label className="file-input">
|
||||
<input
|
||||
type="file"
|
||||
name="file"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
disabled={isDisabled}
|
||||
accept=".doc,.docx,.txt,.pdf,.ppt,.pptx"
|
||||
/>
|
||||
<div className="upload-file-btn">
|
||||
<img src={fileUpload} alt="" className="icon" />
|
||||
<span>{fileAttached ? 'Файл прикреплен' : 'Прикрепить файл'}</span>
|
||||
</div>
|
||||
</label>
|
||||
{fileAttached &&
|
||||
<button className="remove-btn icon" onClick={handleRemoveFile}>
|
||||
<img src={cross} alt="Открепить файл" className="icon remove" />
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
) : (
|
||||
<input
|
||||
className={className}
|
||||
type={type}
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
required
|
||||
disabled={isDisabled}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Field;
|
||||
@@ -1,47 +0,0 @@
|
||||
// .field {
|
||||
// padding: 12px 16px;
|
||||
// border: none;
|
||||
// border-radius: 8px;
|
||||
|
||||
// font-size: 16px;
|
||||
// font-weight: 400;
|
||||
// }
|
||||
|
||||
// .field.big {
|
||||
// height: 200px;
|
||||
// line-height: 30px;
|
||||
// resize: none;
|
||||
// }
|
||||
|
||||
// .file-input {
|
||||
// position: relative;
|
||||
// width: fit-content;
|
||||
|
||||
// input {
|
||||
// position: absolute;
|
||||
// z-index: -1;
|
||||
// opacity: 0;
|
||||
// display: block;
|
||||
// width: 0;
|
||||
// height: 0;
|
||||
// }
|
||||
|
||||
// .upload-file-btn {
|
||||
// display: flex;
|
||||
// cursor: pointer;
|
||||
|
||||
// .icon {
|
||||
// margin-right: 6px;
|
||||
// height: 22px;
|
||||
// }
|
||||
|
||||
// span {
|
||||
// display: inline-block;
|
||||
// font-size: 18px;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// .file-input input:focus + .upload-file-btn {
|
||||
// outline: -webkit-focus-ring-color auto 1px;
|
||||
// }
|
||||
@@ -1,65 +0,0 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import FooterLink from './FooterLink';
|
||||
import FooterContacts from './FooterContacts';
|
||||
import { getMedia } from '../../api';
|
||||
|
||||
import { scb as logo } from '../../assets/images';
|
||||
import { iconIctis, iconSfedu, iconVK } from '../../assets/images/footer';
|
||||
import './Footer.styles.scss';
|
||||
|
||||
const mockLinks = {
|
||||
ictis: {
|
||||
src: iconIctis,
|
||||
to: "https://ictis.sfedu.ru",
|
||||
},
|
||||
sfedu: {
|
||||
src: iconSfedu,
|
||||
to: "https://sfedu.ru",
|
||||
},
|
||||
vk: {
|
||||
src: iconVK,
|
||||
to: "https://vk.com/skbkit",
|
||||
},
|
||||
};
|
||||
|
||||
const mockContacts = {
|
||||
email: (
|
||||
<a style={{ color: 'inherit' }} href="mailto:skb@sfedu.ru">skb@sfedu.ru</a>
|
||||
),
|
||||
address: (
|
||||
<a style={{ color: 'inherit' }} href="https://yandex.ru/maps/?text=г.%20Таганрог,%20пер.%20Тургеневский,%2044" target="_blank" rel="noopener noreferrer">
|
||||
г. Таганрог, пер. Тургеневский, 44
|
||||
</a>
|
||||
),
|
||||
phone: (
|
||||
<a style={{ color: 'inherit' }} href="tel:+79780095480">+7 (978) 009-54-80</a>
|
||||
),
|
||||
};
|
||||
|
||||
function Footer({ links = mockLinks, contacts = mockContacts }) {
|
||||
const [mediaList, setMediaList] = useState(links);
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newMediaList = await getMedia('footer', mediaList);
|
||||
setMediaList(newMediaList);
|
||||
console.log('footerMedia', newMediaList);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<footer id="footer">
|
||||
<div className="logo-container">
|
||||
<img className="logo" alt="logo" src={ logo } />
|
||||
</div>
|
||||
<FooterContacts contacts={ contacts } />
|
||||
<div className="links">
|
||||
{ Object.keys(mediaList).map(link => <FooterLink link={ mediaList[link] } key={ mediaList[link].id } />) }
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
||||
@@ -1,134 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
@import "bootstrap/scss/bootstrap"; // Подключение Bootstrap
|
||||
|
||||
#footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
height: 192px;
|
||||
padding: 0 10%;
|
||||
margin: 2em 0 0;
|
||||
background: $bg-footer;
|
||||
|
||||
// Добавление SVG-фона
|
||||
background-image: url("../../assets/images/backround/bg_footer_gray_02.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center bottom;
|
||||
background-size: cover; // или `contain` в зависимости от эффекта
|
||||
|
||||
.container-fluid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
height: 52%;
|
||||
max-width: 22%;
|
||||
|
||||
.logo {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.contacts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
max-height: 70%;
|
||||
height: 40%;
|
||||
|
||||
p {
|
||||
color: $text-secondary;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
line-height: 16px;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
|
||||
.link {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
width: 60px;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 100%;
|
||||
background-color: $bg-primary;
|
||||
|
||||
.icon {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
height: auto;
|
||||
padding: 1.5em 10%;
|
||||
position: relative;
|
||||
|
||||
.container-fluid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
height: auto;
|
||||
max-width: 60%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.logo {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.contacts {
|
||||
text-align: center;
|
||||
gap: 0.5em;
|
||||
width: 100%;
|
||||
padding: 10px 0;
|
||||
p {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
|
||||
.link {
|
||||
width: 45px;
|
||||
transition: background 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: darken($bg-primary, 10%);//
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 65%;
|
||||
height: 65%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#root:has(#mainpageheader) #footer {
|
||||
background-image: url("../../assets/images/backround/bg_footer_gray.svg");
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
function FooterContacts({ contacts }) {
|
||||
return (
|
||||
<div className="contacts">
|
||||
<p>{ contacts.email }</p>
|
||||
<p>{ contacts.address }</p>
|
||||
<p>{ contacts.phone }</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default FooterContacts;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
function FooterLink({ link }) {
|
||||
return (
|
||||
<Link to={ link.to } className="link" target="_blank">
|
||||
<img src={ link.src } alt='icon' className='icon'/>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export default FooterLink;
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
function LabCard({ lab }) {
|
||||
return (
|
||||
<Link className="card lab" to={'/labs/' + lab.id}>
|
||||
<img src={lab.preview} alt="" className="image" />
|
||||
<div className="card-content">
|
||||
<h2>{lab.name}</h2>
|
||||
<div className="hidden">
|
||||
<p>{lab.previewText}</p>
|
||||
<div className="link-label">Перейти ⟶</div> {/*→*/}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export default LabCard;
|
||||
@@ -1,67 +0,0 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import LabCard from './LabCard';
|
||||
|
||||
import { getLabs } from '../../api';
|
||||
|
||||
import { labMock } from '../../assets/images';
|
||||
import './LabList.styles.scss';
|
||||
|
||||
const mock = {
|
||||
cyber: {
|
||||
name: "Лаборатория кибернетики",
|
||||
previewText: "Управление робототехническими системами, создание аппаратных и программных продуктов, а также проектирование программных систем.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
cv: {
|
||||
name: "Лаборатория компьютерного зрения",
|
||||
previewText: "Работа с методами и технологиями сегментации изображений, ИИ и нейронными сетями.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
st: {
|
||||
name: "Лаборатория SmartTech",
|
||||
previewText: "Проектирование систем в концепции “Интернета вещей” и технологии “Умного дома”.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
vr: {
|
||||
name: "Лаборатория VR и AR",
|
||||
previewText: "Разработка приложений для виртуальной и дополненной реальности, 3D-моделирование.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
mobile: {
|
||||
name: "Лаборатория мобильной разработки",
|
||||
previewText: "Разработка приложений для портативных устройств, создание дизайна и проектов мобильных приложений.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
print: {
|
||||
name: "Лаборатория 3D-печати и прототипирования",
|
||||
previewText: "Проектирование 3D-модели, работа с 3D-принтером и создание качественных трёхмерных макетов.",
|
||||
link: "/labs",
|
||||
preview: labMock,
|
||||
},
|
||||
};
|
||||
|
||||
function LabList() {
|
||||
const [labList, setLabList] = useState(mock);
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newLabList = await getLabs();
|
||||
setLabList(newLabList);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="row lab-list">
|
||||
{Object.values(labList).map(lab => <LabCard key={lab.id} lab={lab} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LabList;
|
||||
@@ -1,123 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
|
||||
.row.lab-list {
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
/* Используем 1fr для равных колонок */
|
||||
justify-content: space-between;
|
||||
gap: $row-gap;
|
||||
max-width: 100%; // Гарантия, что не выйдет за границы
|
||||
width: 100%;
|
||||
box-sizing: border-box; // Учитываем padding и border внутри ширины
|
||||
|
||||
.card {
|
||||
display: block;
|
||||
position: relative;
|
||||
height: 300px;
|
||||
border-radius: 8px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: transparent;
|
||||
color: $text-secondary;
|
||||
|
||||
|
||||
border: 1px solid transparent;
|
||||
|
||||
.image {
|
||||
position: absolute;
|
||||
object-fit: cover;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s ease-out;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
overflow: hidden;
|
||||
/* Чтобы контент не выходил за границы и карточка не мигала*/
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
inset: auto 20px 10px 20px;
|
||||
transition: inset .3s;
|
||||
background: none !important;
|
||||
z-index: 2;
|
||||
/* Контент всегда сверху */
|
||||
|
||||
h2 {
|
||||
margin: 0 0 12px 9px;
|
||||
font-size: clamp(10px, 1.5vw, 20px);
|
||||
font-weight: 600;
|
||||
line-height: clamp(12px, 2vw, 24px);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
max-height: 0;
|
||||
transition: max-height 0.3s ease-out, opacity 0.3s 0.3s ease-out;
|
||||
opacity: 0;
|
||||
max-width: 80%;
|
||||
|
||||
p {
|
||||
margin: 0 0 10px 9px;
|
||||
font-size: clamp(8px, 1.5vw, 16px);
|
||||
font-weight: 400;
|
||||
line-height: clamp(16px, 2vw, 20px);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.link-label {
|
||||
font-size: clamp(10px, 1.5vw, 20px);
|
||||
font-weight: 500;
|
||||
line-height: clamp(18px, 2vw, 24px);
|
||||
margin: 0 0 0 9px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 20px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .card-content {
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
&:hover .card-content .hidden {
|
||||
max-height: 200px;
|
||||
opacity: 1;
|
||||
transition: max-height 0.3s ease-out, opacity .1s ease-in;
|
||||
}
|
||||
|
||||
&:hover .image {
|
||||
transition: opacity .3s ease-in;
|
||||
filter: brightness(0.6);
|
||||
/* Затемняем изображение */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Медиа-запрос для мобильных устройств
|
||||
@media (max-width: 768px) {
|
||||
.row.lab-list {
|
||||
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
/* Карточка занимает всю ширину своей колонки */
|
||||
height: 215px !important;
|
||||
/* Устанавливаем минимальную высоту */
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
export { default as LabCard } from "./LabCard";
|
||||
export { default as LabList } from "./LabList";
|
||||
@@ -1,25 +0,0 @@
|
||||
import { useState } from "react";
|
||||
|
||||
function LoadMore({list, setter, loader, count, setFull}) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleLoadMore = async () => {
|
||||
setIsLoading(true);
|
||||
const newPart = await loader(count, list.length);
|
||||
const newList = [...list, ...newPart];
|
||||
setter(newList);
|
||||
setIsLoading(false);
|
||||
|
||||
if (newPart.length < count) {
|
||||
setFull(true);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<button className="btn" onClick={handleLoadMore} disabled={isLoading} >
|
||||
Показать еще
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export default LoadMore;
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './LoadMore';
|
||||
@@ -1,13 +0,0 @@
|
||||
import MediaContainer from "../MediaContainer";
|
||||
|
||||
import "./MediaBlock.styles.scss";
|
||||
|
||||
function MediaBlock({ images }) {
|
||||
return (
|
||||
<div className="media-block">
|
||||
{ images.map((item, index) => <MediaContainer src={item} key={index} />) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MediaBlock;
|
||||
@@ -1,108 +0,0 @@
|
||||
import NavbarLink from './NavbarLink';
|
||||
import { scb_blue as logo } from '../../assets/images';
|
||||
import './Navbar.styles.scss';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
const mock = [
|
||||
{ text: "НОВОСТИ", to: "/news" },
|
||||
{ text: "О НАС", to: "/aboutus" },
|
||||
{ text: "ЛАБОРАТОРИИ", to: "/labs" },
|
||||
{ text: "ПРОЕКТЫ", to: "/projects" },
|
||||
{ text: "КОНТАКТЫ", to: "/contact" },
|
||||
{ text: "ИКТИБ", to: "https://ictis.sfedu.ru", newTab: true },
|
||||
];
|
||||
|
||||
function Navbar({ links = mock }) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isTransparent, setIsTransparent] = useState(true); // Navbar начально прозрачный
|
||||
const [isHidden, setIsHidden] = useState(false);
|
||||
const [lastScrollTop, setLastScrollTop] = useState(0);
|
||||
const [scrolledOnce, setScrolledOnce] = useState(false); // Флаг для первого скролла
|
||||
const THRESHOLD = 400; // Порог для скрытия Navbar при скролле вниз
|
||||
const location = useLocation(); // Для отслеживания текущего пути
|
||||
|
||||
const toggleMenu = () => setIsOpen(!isOpen);
|
||||
const handleLinkClick = () => setIsOpen(false);
|
||||
|
||||
// При изменении маршрута обновляем прозрачность Navbar
|
||||
useEffect(() => {
|
||||
if (location.pathname === '/') {
|
||||
setIsTransparent(true);
|
||||
window.scrollTo(0, 0);
|
||||
} else {
|
||||
setIsTransparent(false);
|
||||
}
|
||||
setScrolledOnce(false);
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
const currentScrollTop = window.pageYOffset;
|
||||
if (!isOpen) {
|
||||
// Логика скрытия Navbar при скролле вниз
|
||||
if (currentScrollTop <= THRESHOLD) {
|
||||
setIsHidden(false); // Navbar видим, если скролл маленький
|
||||
} else {
|
||||
if (currentScrollTop > lastScrollTop) {
|
||||
setIsHidden(true); // Скрыть Navbar при скролле вниз
|
||||
} else {
|
||||
setIsHidden(false); // Показать Navbar при скролле вверх
|
||||
}
|
||||
}
|
||||
}
|
||||
// Прозрачность только при первом скролле на главной странице
|
||||
if (location.pathname === "/" && !scrolledOnce && currentScrollTop > 50) {
|
||||
setIsTransparent(false);
|
||||
setScrolledOnce(true);
|
||||
}
|
||||
|
||||
setLastScrollTop(currentScrollTop);
|
||||
};
|
||||
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => window.removeEventListener("scroll", handleScroll);
|
||||
}, [lastScrollTop, scrolledOnce, location.pathname, isOpen]);
|
||||
|
||||
// Обработчик события при возвращении на главную (при использовании кнопки "назад")
|
||||
useEffect(() => {
|
||||
const handlePopState = () => {
|
||||
if (location.pathname === '/') {
|
||||
setIsTransparent(true);
|
||||
// Прокручиваем страницу вверх при возврате на главную
|
||||
window.scrollTo(0, 0);
|
||||
} else {
|
||||
setIsTransparent(false);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('popstate', handlePopState);
|
||||
return () => window.removeEventListener('popstate', handlePopState);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<div id="navbar" className={`${isTransparent ? "transparent" : ""} ${isHidden ? "hidden" : ""}`}>
|
||||
<NavbarLink className="logo-container" link={{
|
||||
to: "/",
|
||||
onClick: () => {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
}}>
|
||||
<img src={logo} className="logo" alt="SCB logo" />
|
||||
</NavbarLink>
|
||||
<div className="burger" onClick={toggleMenu}>
|
||||
<span className={`line ${isOpen ? 'open' : ''}`}></span>
|
||||
<span className={`line ${isOpen ? 'open' : ''}`}></span>
|
||||
<span className={`line ${isOpen ? 'open' : ''}`}></span>
|
||||
</div>
|
||||
<div className={`bar ${isOpen ? 'open' : ''}`}>
|
||||
{links.map((link, index) => (
|
||||
<NavbarLink link={{ ...link, onClick: handleLinkClick }} key={index} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -1,134 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
@import "bootstrap/scss/bootstrap";
|
||||
|
||||
#navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 108px;
|
||||
padding: $navbar-padding-tb 10%;
|
||||
background-color: rgb(255, 255, 255);
|
||||
z-index: 100;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
transition: transform 0.3s ease-out, height 0.3s ease-out, background-color 0.8s ease-out;
|
||||
|
||||
&.hidden {
|
||||
transform: translateY(-110%); // Убираем navbar вверх
|
||||
}
|
||||
|
||||
&:not(.hidden) {
|
||||
transform: translateY(0); // Показываем navbar
|
||||
}
|
||||
|
||||
&.transparent {
|
||||
background-color: transparent !important;
|
||||
transition: none;
|
||||
|
||||
.bar .nav-link {
|
||||
color: $text-secondary;
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
color: black;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.burger .line {
|
||||
background-color: #ffffff;
|
||||
&.open {
|
||||
background-color: #072ac8; // Синий цвет, когда меню открыто
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
}
|
||||
|
||||
.nav-link:has(> .logo) {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
|
||||
.logo {
|
||||
width: $navbar-logo-height;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.nav-link {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 20px;
|
||||
letter-spacing: 0em;
|
||||
padding: .25em;
|
||||
margin-left: 40px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.nav-link::after {
|
||||
background: $text-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
height: $navbar-height;
|
||||
padding: $navbar-padding-tb 5%;
|
||||
|
||||
.nav-link:has(> .logo) .logo {
|
||||
width: $navbar-logo-mini-height;
|
||||
}
|
||||
|
||||
.bar {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
width: 50%;
|
||||
height: 200vh;
|
||||
z-index: 9;
|
||||
padding: 60px 0px;
|
||||
|
||||
&.open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
padding: 10px 5px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.burger {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 10;
|
||||
|
||||
.line {
|
||||
width: 25px;
|
||||
height: 3px;
|
||||
background-color: #072ac8;
|
||||
margin: 4px 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { NavLink } from "react-router-dom";
|
||||
import { Children } from "react";
|
||||
|
||||
function NavbarLink({ link, children }) {
|
||||
return (
|
||||
<NavLink
|
||||
className={({ isActive, isPending }) =>
|
||||
`nav-link ${isActive ? 'active' : isPending ? 'disabled' : ''
|
||||
}`
|
||||
}
|
||||
to={link.to}
|
||||
target={link.newTab && '_blank'}
|
||||
>
|
||||
{link.text}
|
||||
{Children.map(children, (child) => (
|
||||
<>
|
||||
{child}
|
||||
</>
|
||||
))}
|
||||
</NavLink >
|
||||
);
|
||||
}
|
||||
|
||||
export default NavbarLink;
|
||||
@@ -1,79 +0,0 @@
|
||||
$news-card-gap: 1em;
|
||||
|
||||
#news-list {
|
||||
.row {
|
||||
display: flex;
|
||||
flex-wrap: wrap; // Чтобы карточки корректно переносились
|
||||
gap: $news-card-gap;
|
||||
justify-content: space-between; // Равномерное распределение карточек
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
border: none;
|
||||
margin-bottom: 1em; // Отступ снизу
|
||||
@media (max-width: 768px) {
|
||||
width: 100%; // 1 карточка в ряд на мобильных
|
||||
height: 215px; // Меньшая высота для мобильных
|
||||
}
|
||||
|
||||
.pic {
|
||||
aspect-ratio: 1 / 1;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8px; // Округляем углы изображения
|
||||
overflow: hidden; // Обрезаем лишнее
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 40%;
|
||||
/* Градиент покрывает 40% карточки */
|
||||
background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
|
||||
border-radius: 8px;
|
||||
pointer-events: none;
|
||||
/* Не мешает взаимодействию */
|
||||
z-index: 0;
|
||||
/* Градиент уходит в фон */
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center; // Устанавливаем позицию обрезки сверху
|
||||
border-radius: 8px; // Округление углов изображения
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
min-height: 15%;
|
||||
padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-radius: 0 0 8px 8px;
|
||||
font-size: clamp(10px, 1.5vw, 20px);
|
||||
font-weight: 600;
|
||||
line-height: clamp(12px, 2vw, 24px);
|
||||
color: white;
|
||||
|
||||
//background: rgba(0, 0, 0, 0.6);
|
||||
//background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
|
||||
@media (max-width: 768px) {
|
||||
padding: 22px 16px;
|
||||
font-size: 20px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
function NewsCard({ news }) {
|
||||
|
||||
return (
|
||||
<Link className="card" to={ `/news/` + news.id }>
|
||||
<div className='pic'>
|
||||
<img className='image' src={ news.preview } alt="news_image" ></img>
|
||||
<div className="label">
|
||||
{ news.heading }
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export default NewsCard;
|
||||
@@ -1,47 +0,0 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import NewsCard from './NewsCard';
|
||||
|
||||
import { getNews } from '../../api';
|
||||
|
||||
import './News.styles.scss';
|
||||
import LoadMore from '../LoadMore';
|
||||
|
||||
function NewsList({ isMainPage = false }) {
|
||||
const [newsList, setNewsList] = useState();
|
||||
const [isFullList, setIsFullList] = useState(false);
|
||||
|
||||
const count = isMainPage ? 4 : 8;
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newNewsList = await getNews(count);
|
||||
setNewsList(newNewsList);
|
||||
if (newNewsList.length < count) {
|
||||
setIsFullList(true);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{newsList ? (
|
||||
<div id="news-list">
|
||||
<div className="row">
|
||||
{newsList.map(item => <NewsCard key={item.id} news={item} />)}
|
||||
</div>
|
||||
{ !isMainPage && !isFullList &&
|
||||
<LoadMore list={newsList} setter={setNewsList} loader={getNews} count={count} setFull={setIsFullList} />
|
||||
}
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
Загрузка...
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default NewsList;
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./NewsList";
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import "./ProjectCard.styles.scss";
|
||||
|
||||
function ProjectCard({ project }) {
|
||||
return (
|
||||
<Link className="card" to={ `/projects/` + project.id }>
|
||||
<img className="image" alt="project_image" src={project.preview}></img>
|
||||
<div className="label">
|
||||
{ `Проект "${project.name}"` }
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProjectCard;
|
||||
@@ -1,44 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
|
||||
.project-list {
|
||||
|
||||
.card {
|
||||
display: block;
|
||||
position: relative;
|
||||
height: 250px;
|
||||
@media (max-width: 768px) {
|
||||
max-width: 100%;
|
||||
height: 215px;
|
||||
}
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: transparent;
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
position: absolute;
|
||||
left: 11px;
|
||||
bottom: 0px;
|
||||
border-radius: 8px;
|
||||
padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
|
||||
line-height: 28px;
|
||||
color: $text-card-project;
|
||||
font-size: clamp(12px, 1.8vw, 20px);
|
||||
font-weight: 600;
|
||||
line-height: clamp(14px, 2vw, 24px);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
padding: 22px 16px;
|
||||
font-size: 20px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import ProjectCard from "./ProjectCard";
|
||||
import { getProjects } from "../../api";
|
||||
|
||||
import "./ProjectList.styles.scss";
|
||||
|
||||
function ProjectList({ laboratory }) {
|
||||
const [projectList, setProjectList] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newProjectList = await getProjects(laboratory);
|
||||
setProjectList(newProjectList);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="row project-list">
|
||||
{Object.keys(projectList).map(id => <ProjectCard key={id} project={projectList[id]} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProjectList;
|
||||
@@ -1,20 +0,0 @@
|
||||
@import "../../assets/styles/theme.scss";
|
||||
|
||||
.project-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 32px;
|
||||
|
||||
.card {
|
||||
flex: 1 1 30%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.project-list {
|
||||
.card {
|
||||
flex: 1 1 100%; // Карточки будут занимать всю ширину на мобильных
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./ProjectList";
|
||||
@@ -1,87 +0,0 @@
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Pagination } from 'swiper/modules';
|
||||
|
||||
import 'swiper/css';
|
||||
import 'swiper/css/navigation';
|
||||
import 'swiper/css/pagination';
|
||||
|
||||
import { getMedia } from '../../api';
|
||||
import './Slider.styles.scss';
|
||||
|
||||
import arrow from "../../assets/images/arrow.svg";
|
||||
|
||||
function Slider({ autoPlay = false, autoPlayTime = 3000, images = false, variant = "default" }) {
|
||||
const [mediaList, setMediaList] = useState([]);
|
||||
const [itemsPerSlide, setItemsPerSlide] = useState(window.innerWidth <= 768 ? 1 : 2);
|
||||
const [enableButtons, setEnableButtons] = useState(false);
|
||||
|
||||
const swiperRef = useRef(null); // для кнопок
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
setItemsPerSlide(isMobile ? 1 : 2);
|
||||
|
||||
// Показываем кнопки, если на мобильной версии показывается 1 картинка, а всего их больше 1
|
||||
setEnableButtons(isMobile ? mediaList.length > 1 : mediaList.length > 2);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
handleResize(); // Вызываем сразу, чтобы не ждать первого ресайза
|
||||
|
||||
return () => window.removeEventListener('resize', handleResize);
|
||||
}, [mediaList]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newMediaList = images
|
||||
? images.map((value, key) => ({ id: key, src: value }))
|
||||
: await getMedia('gallery');
|
||||
|
||||
setMediaList(newMediaList);
|
||||
setEnableButtons(newMediaList.length > 1);
|
||||
};
|
||||
|
||||
loadData();
|
||||
}, [images]);
|
||||
|
||||
// Фиксим центрирование 1 слайда
|
||||
const slidesView = mediaList.length === 1 ? 1 : (variant === "news" ? (window.innerWidth <= 768 ? 1 : 1.4) : itemsPerSlide);
|
||||
|
||||
// Проверяем, сколько изображений, чтобы отключить анимацию для 2 или менее изображений
|
||||
const sliderClass = mediaList.length <= 2 && variant === 'news' ? 'no-animation' : '';
|
||||
|
||||
|
||||
return (
|
||||
<div className={`slider ${variant} ${sliderClass}`}>
|
||||
{/* Кастомные стрелки */}
|
||||
{enableButtons && (
|
||||
<div className="custom-navigation">
|
||||
<button className="custom-prev" onClick={() => swiperRef.current?.slidePrev()}><img src={arrow} alt="prev"/></button>
|
||||
<button className="custom-next" onClick={() => swiperRef.current?.slideNext()}><img src={arrow} alt="next" style={{ transform: "rotate(180deg)" }}/></button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Swiper
|
||||
modules={[Navigation, Pagination]}
|
||||
spaceBetween={variant === "news" ? 20 : 30}
|
||||
slidesPerView={slidesView}
|
||||
centeredSlides={mediaList.length === 1 ? false : variant === "news"}
|
||||
slidesPerGroup={1}
|
||||
loop={enableButtons}
|
||||
pagination={{ clickable: enableButtons }}
|
||||
autoplay={autoPlay ? { delay: autoPlayTime, disableOnInteraction: false } : false}
|
||||
onSwiper={(swiper) => (swiperRef.current = swiper)} // Связываем Swiper с ref
|
||||
>
|
||||
{mediaList.map((media, index) => (
|
||||
<SwiperSlide key={media.id} className={mediaList.length === 1 ? 'swiper-slide single' : 'swiper-slide'}>
|
||||
<img src={media.src} alt={`slide-${index}`} className='slide-image' />
|
||||
</SwiperSlide>
|
||||
))}
|
||||
</Swiper>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Slider;
|
||||
@@ -1,127 +0,0 @@
|
||||
.slider {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
padding: 10px 0;
|
||||
|
||||
.swiper-slide {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 48vh;
|
||||
bottom: 10px;
|
||||
|
||||
.slide-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
height: 350px;
|
||||
object-fit: cover;
|
||||
object-position: center center; //
|
||||
border-radius: 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-wrapper:has(.swiper-slide.single) {
|
||||
justify-content: center;
|
||||
|
||||
.swiper-slide.single {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.slide-image {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
object-position: center center;
|
||||
pointer-events: none;
|
||||
border-radius: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* стрелки */
|
||||
/* Кастомные стрелки */
|
||||
.custom-navigation {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.custom-prev,
|
||||
.custom-next {
|
||||
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;
|
||||
}
|
||||
|
||||
.custom-prev {
|
||||
margin-left: -70px;
|
||||
@media (max-width: 768px) {
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-next {
|
||||
margin-right: -70px;
|
||||
@media (max-width: 768px) {
|
||||
margin-right: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.slider.news {
|
||||
.swiper-slide {
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
|
||||
height: 65vh;
|
||||
|
||||
.slide-image {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
opacity: 1;
|
||||
transition: none;
|
||||
height: 48vh;
|
||||
.slide-image {
|
||||
height: 350px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-slide-active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.no-animation .swiper-slide {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.swiper-wrapper:has(.swiper-slide.single) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// import { useEffect } from "react";
|
||||
|
||||
function VKvideo({ video }) {
|
||||
video.url = `https://vk.com/video_ext.php?id=${video.id}&oid=${video.oid}`;
|
||||
|
||||
return (
|
||||
<iframe
|
||||
title="vkvideo"
|
||||
class="vkvideo"
|
||||
src={video.url}
|
||||
width={video.width}
|
||||
height={video.height}
|
||||
allow="autoplay; encrypted-media; fullscreen; picture-in-picture;" frameborder="0"
|
||||
allowfullscreen>
|
||||
</iframe>
|
||||
);
|
||||
}
|
||||
|
||||
export default VKvideo;
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './VKvideo.jsx';
|
||||
@@ -1,12 +0,0 @@
|
||||
export { default as ContactForm } from './ContactForm';
|
||||
export { default as Field } from './Field';
|
||||
export { default as Footer } from './Footer';
|
||||
export { LabList } from './Labs';
|
||||
export { default as MediaBlock } from './MediaBlock';
|
||||
export { default as MediaContainer } from './MediaContainer';
|
||||
export { default as Navbar } from './Navbar';
|
||||
export { default as Slider } from './Slider';
|
||||
export { default as ProjectList } from './Projects';
|
||||
export { default as NewsList } from './News';
|
||||
export { default as VKvideo } from './VKvideo';
|
||||
export { default as LoadMore } from './LoadMore';
|
||||
@@ -1,21 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { createHashRouter, RouterProvider } from 'react-router-dom';
|
||||
|
||||
import routes from './routes';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import './assets/styles/global.scss';
|
||||
|
||||
const router = createHashRouter(routes);
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<RouterProvider router={router} />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
@@ -1,14 +0,0 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
const ScrollToTop = () => {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default ScrollToTop;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const useElementOnScreen = (options) => {
|
||||
|
||||
const [ref, setRef] = useState(null);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
const observerCallback = (entries) => {
|
||||
const [entry] = entries;
|
||||
setIsVisible(entry.isIntersecting);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const observer = new IntersectionObserver(observerCallback, options);
|
||||
|
||||
if (ref) {
|
||||
observer.observe(ref);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (ref) {
|
||||
observer.unobserve(ref);
|
||||
}
|
||||
}
|
||||
}, [ref, options]);
|
||||
|
||||
return [setRef, isVisible];
|
||||
}
|
||||
|
||||
export default useElementOnScreen;
|
||||
@@ -0,0 +1,9 @@
|
||||
import App from "@/app/App";
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
import { skbEndpoint } from "@/shared/api/wp-client";
|
||||
|
||||
export const submitContactForm = async (formData: FormData) => {
|
||||
const response = await fetch(`${skbEndpoint}skbkit/v1/sendcontactform`, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error("Form submission failed");
|
||||
return response;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { submitContactForm } from "../api/post";
|
||||
|
||||
export const useContactForm = () => {
|
||||
return useMutation({
|
||||
mutationFn: submitContactForm,
|
||||
onSuccess: () => console.log("Форма успешно отправлена"),
|
||||
onError: (error: Error) => console.error("Ошибка отправки:", error),
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export { useMedia } from "./media/hooks/useMedia";
|
||||
export { usePostById } from "./posts/hooks/usePostById";
|
||||
export { useNews } from "./news/hooks/useNews";
|
||||
export { useContactForm } from "./contact/hooks/useContactForm";
|
||||
@@ -0,0 +1,47 @@
|
||||
import { wp } from "@/shared/api/wp-client";
|
||||
import { WPv2 } from "@/shared/types/app";
|
||||
|
||||
export interface MediaItem {
|
||||
id: number;
|
||||
src: string;
|
||||
category: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция для получения всех медиафайлов с учетом пагинации
|
||||
*/
|
||||
export const fetchMedia = async (): Promise<MediaItem[]> => {
|
||||
let page = 1;
|
||||
let allMedia: MediaItem[] = [];
|
||||
let hasMore = true;
|
||||
|
||||
while (hasMore) {
|
||||
try {
|
||||
// Запрашиваем медиа с указанной страницы
|
||||
const media = (await wp.media().page(page)) as WPv2.Media[];
|
||||
|
||||
// Если медиа нет, завершаем цикл
|
||||
if (!media.length) {
|
||||
hasMore = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Преобразуем данные и добавляем в общий массив
|
||||
const transformedMedia = media.map(({ id, source_url, alt_text }) => {
|
||||
const [category = "uncategorized", name = "unknown"] =
|
||||
alt_text?.split("_") || [];
|
||||
return { id, src: source_url, category, name };
|
||||
});
|
||||
|
||||
allMedia = [...allMedia, ...transformedMedia];
|
||||
page++; // Переходим на следующую страницу
|
||||
} catch (error) {
|
||||
// Если произошла ошибка (например, страница не найдена), завершаем цикл
|
||||
hasMore = false;
|
||||
console.error("Ошибка при загрузке медиа:", error);
|
||||
}
|
||||
}
|
||||
|
||||
return allMedia;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { fetchMedia } from "@/modules/media/api/get";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export const useMedia = () => {
|
||||
return useQuery({
|
||||
queryKey: ["media"],
|
||||
queryFn: fetchMedia,
|
||||
staleTime: 1000 * 60 * 5, // 5 минут
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
import { skbEndpoint } from "@/shared/api/wp-client";
|
||||
import { SKBKit } from "@/shared/types/app";
|
||||
|
||||
export const fetchNews = async <T = SKBKit.News[]>(params?: {
|
||||
count?: number;
|
||||
offset?: number;
|
||||
}): Promise<SKBKit.ApiResponse<T>> => {
|
||||
const url = new URL(`${skbEndpoint}skbkit/v1/getnews`);
|
||||
|
||||
if (params) {
|
||||
if (params.count) url.searchParams.set("count", params.count.toString());
|
||||
if (params.offset) url.searchParams.set("offset", params.offset.toString());
|
||||
}
|
||||
|
||||
const response = await fetch(url.toString());
|
||||
const data: T = await response.json();
|
||||
|
||||
return {
|
||||
data,
|
||||
headers: {
|
||||
"x-wp-total": response.headers.get("x-wp-total") || "0",
|
||||
"x-wp-totalpages": response.headers.get("x-wp-totalpages") || "0",
|
||||
},
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import { fetchNews } from "@/modules/news/api/get";
|
||||
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
||||
|
||||
export const useNews = (params?: { count?: number; offset?: number }) => {
|
||||
return useQuery({
|
||||
queryKey: ["news", params],
|
||||
queryFn: () => fetchNews(params),
|
||||
select: (news) => news.data,
|
||||
placeholderData: keepPreviousData,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { skbEndpoint } from "@/shared/api/wp-client";
|
||||
import { SKBKit } from "@/shared/types/app";
|
||||
export const fetchNewsById = async (id: string): Promise<SKBKit.News> => {
|
||||
const response = await fetch(`${skbEndpoint}skbkit/v1/getnewsbyid?id=${id}`);
|
||||
if (!response.ok) throw new Error("Ошибка при загрузке новости");
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export const useNewsById = (id: string) => {
|
||||
return useQuery<SKBKit.News>({
|
||||
queryKey: ["news", id],
|
||||
queryFn: () => fetchNewsById(id),
|
||||
enabled: !!id,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
// posts/api/get.ts
|
||||
import { wp } from "@/shared/api/wp-client";
|
||||
import { parseContent } from "@/shared/api/parseContent";
|
||||
import { fetchMedia } from "@/modules/media/api/get";
|
||||
import { App, WPv2 } from "@/shared/types/app";
|
||||
import Parse from "html-react-parser";
|
||||
export const fetchPosts = async (): Promise<App.PostsResult> => {
|
||||
const [posts, categories, tags, mediaLibrary] = await Promise.all([
|
||||
wp.posts().param("per_page", 100).get() as Promise<WPv2.Post[]>,
|
||||
wp.categories().get() as Promise<WPv2.Category[]>,
|
||||
wp.tags().get() as Promise<WPv2.Tag[]>,
|
||||
fetchMedia(),
|
||||
]);
|
||||
|
||||
const categoryMap = new Map<number, string>(
|
||||
categories.map((c) => [c.id, c.name])
|
||||
);
|
||||
const tagMap = new Map<number, string>(tags.map((t) => [t.id, t.name]));
|
||||
|
||||
const result: App.PostsResult = {
|
||||
projects: {},
|
||||
labs: {},
|
||||
other: [],
|
||||
};
|
||||
|
||||
for (const post of posts) {
|
||||
const image = mediaLibrary.find((item) => item.id === post.featured_media);
|
||||
const postCategories = post.categories.map(
|
||||
(id) => categoryMap.get(id) || ""
|
||||
);
|
||||
|
||||
const newPost: App.ProjectPost = {
|
||||
id: post.id,
|
||||
title: post.title.rendered,
|
||||
content: parseContent(post.content.rendered),
|
||||
lab: "",
|
||||
preview: image?.src || null,
|
||||
categories: postCategories,
|
||||
tag: post.tags.map((id) => tagMap.get(id) || "")[0] || "",
|
||||
};
|
||||
|
||||
if (postCategories.includes("projects")) {
|
||||
newPost.lab = postCategories.filter((c) => c !== "projects")[0] || "";
|
||||
result.projects[post.id] = newPost;
|
||||
} else if (postCategories.includes("labs")) {
|
||||
//@ts-ignore
|
||||
const excerptElement = Parse(post.excerpt.rendered)[0];
|
||||
newPost.previewText = (excerptElement as any)?.props?.children || "";
|
||||
result.labs[post.id] = newPost as App.LabPost;
|
||||
} else {
|
||||
result.other.push(newPost);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
// posts/api/useProjectById.ts
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { wp } from "@/shared/api/wp-client";
|
||||
import { parseContent } from "@/shared/api/parseContent";
|
||||
import { App, WPv2 } from "@/shared/types/app";
|
||||
|
||||
export const usePostById = (id: number) => {
|
||||
return useQuery<App.ProjectPost>({
|
||||
queryKey: ["project", id],
|
||||
queryFn: async () => {
|
||||
const [post, categories] = await Promise.all([
|
||||
wp.posts().id(id).get() as Promise<WPv2.Post>,
|
||||
wp.categories().param("post", id).get() as Promise<WPv2.Category[]>,
|
||||
]);
|
||||
|
||||
const categoryNames = categories.map((c) => c.name);
|
||||
|
||||
return {
|
||||
id: post.id,
|
||||
title: post.title.rendered,
|
||||
content: parseContent(post.content.rendered),
|
||||
lab: categoryNames.find((c) => c !== "projects") || "",
|
||||
preview: post.featured_media?.toString() || null,
|
||||
categories: categoryNames,
|
||||
tag: "",
|
||||
};
|
||||
},
|
||||
enabled: !!id,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
// posts/api/usePosts.ts
|
||||
import { fetchPosts } from "@/modules/posts/api/get";
|
||||
import { App } from "@/shared/types/app";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export const usePosts = () => {
|
||||
return useQuery<App.PostsResult>({
|
||||
queryKey: ["posts"],
|
||||
queryFn: fetchPosts,
|
||||
staleTime: 1000 * 60 * 5,
|
||||
});
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
import { HashLink } from "react-router-hash-link";
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import { PagePost } from "../components";
|
||||
import { getPosts } from "../../api";
|
||||
|
||||
function AboutUs() {
|
||||
const [post, setPost] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newPost = await getPosts('aboutus');
|
||||
setPost(newPost[0]);
|
||||
console.log('aboutUs post', newPost[0]);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{typeof post !== 'undefined' &&
|
||||
<PagePost post={post} >
|
||||
<div className="btn">Показать еще</div>
|
||||
</PagePost>
|
||||
}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AboutUs;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { CategoryPage } from "@/widgets/CategoryPage/CategoryPage";
|
||||
|
||||
export default function AboutUs() {
|
||||
return <CategoryPage category="aboutus" />;
|
||||
}
|
||||
Executable → Regular
File renamed without changes.
@@ -0,0 +1,190 @@
|
||||
export namespace WPv2 {
|
||||
export interface Title {
|
||||
raw: string;
|
||||
rendered: string;
|
||||
}
|
||||
|
||||
export interface Content {
|
||||
raw: string;
|
||||
rendered: string;
|
||||
block_version?: number;
|
||||
protected?: boolean;
|
||||
}
|
||||
|
||||
export interface Excerpt {
|
||||
raw: string;
|
||||
rendered: string;
|
||||
protected?: boolean;
|
||||
}
|
||||
|
||||
export interface Meta {
|
||||
inline_featured_image?: boolean;
|
||||
footnotes?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface Links {
|
||||
self: Link[];
|
||||
collection: Link[];
|
||||
about?: Link[];
|
||||
author?: EmbeddedLink[];
|
||||
replies?: EmbeddedLink[];
|
||||
"version-history"?: VersionHistoryLink[];
|
||||
"predecessor-version"?: VersionLink[];
|
||||
"wp:featuredmedia"?: EmbeddedLink[];
|
||||
"wp:attachment"?: Link[];
|
||||
"wp:term"?: TermLink[];
|
||||
curies?: Cury[];
|
||||
}
|
||||
|
||||
export interface Link {
|
||||
href: string;
|
||||
targetHints?: {
|
||||
allow: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE")[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface EmbeddedLink extends Link {
|
||||
embeddable: boolean;
|
||||
}
|
||||
|
||||
export interface VersionHistoryLink {
|
||||
count: number;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export interface VersionLink {
|
||||
id: number;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export interface TermLink {
|
||||
taxonomy: string;
|
||||
embeddable: boolean;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export interface Cury {
|
||||
name: "wp";
|
||||
href: string;
|
||||
templated: true;
|
||||
}
|
||||
|
||||
export interface Post {
|
||||
id: number;
|
||||
date: string;
|
||||
date_gmt: string;
|
||||
guid: { rendered: string };
|
||||
modified: string;
|
||||
modified_gmt: string;
|
||||
slug: string;
|
||||
status: "publish" | "draft" | "inherit" | string;
|
||||
type: "post" | "page" | "attachment" | string;
|
||||
link: string;
|
||||
title: Title;
|
||||
content: Content;
|
||||
excerpt: Excerpt;
|
||||
author: number;
|
||||
featured_media?: number;
|
||||
comment_status: "open" | "closed";
|
||||
ping_status: "open" | "closed";
|
||||
sticky: boolean;
|
||||
template: string;
|
||||
format: "standard" | string;
|
||||
meta: Meta;
|
||||
categories: number[];
|
||||
tags: number[];
|
||||
class_list: string[];
|
||||
_links: Links;
|
||||
}
|
||||
|
||||
export interface GetPostsParams {
|
||||
context?: "view" | "embed" | "edit";
|
||||
page?: number;
|
||||
per_page?: number;
|
||||
search?: string;
|
||||
after?: string;
|
||||
before?: string;
|
||||
author?: number[];
|
||||
author_exclude?: number[];
|
||||
exclude?: number[];
|
||||
include?: number[];
|
||||
offset?: number;
|
||||
order?: "asc" | "desc";
|
||||
orderby?:
|
||||
| "author"
|
||||
| "date"
|
||||
| "id"
|
||||
| "include"
|
||||
| "modified"
|
||||
| "parent"
|
||||
| "relevance"
|
||||
| "slug"
|
||||
| "title";
|
||||
slug?: string[];
|
||||
status?: string[];
|
||||
}
|
||||
|
||||
export interface CreatePostParams extends Partial<Post> {}
|
||||
}
|
||||
|
||||
export namespace SKBKit {
|
||||
export interface News {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
date: string;
|
||||
author: string;
|
||||
categories: string[];
|
||||
tags: string[];
|
||||
image_url?: string;
|
||||
excerpt?: string;
|
||||
}
|
||||
|
||||
export interface GetNewsResponse {
|
||||
news: News[];
|
||||
}
|
||||
|
||||
export interface GetNewsByIdParams {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface SendContactFormParams {
|
||||
name: string;
|
||||
email: string;
|
||||
message: string;
|
||||
subject?: string;
|
||||
phone?: string;
|
||||
company?: string;
|
||||
position?: string;
|
||||
}
|
||||
|
||||
export interface Event {
|
||||
id: number;
|
||||
title: string;
|
||||
date: string;
|
||||
location: string;
|
||||
description: string;
|
||||
organizer?: string;
|
||||
participants?: number;
|
||||
image_url?: string;
|
||||
}
|
||||
|
||||
export interface GetEventsResponse {
|
||||
events: Event[];
|
||||
}
|
||||
|
||||
export interface VKCallbackParams {
|
||||
type: string;
|
||||
object: any;
|
||||
group_id: number;
|
||||
event_id?: string;
|
||||
}
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
headers: Record<string, string>;
|
||||
status: number;
|
||||
statusText: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
.mainContainer {
|
||||
margin: 0 10%;
|
||||
@include mediaMax($mobile-xs-width) {
|
||||
margin: 0 5%;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
line-height: 44px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 8px;
|
||||
@include mediaMax($tablet-max-width) {
|
||||
font-size: 24px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { CardData } from "@/widgets/Card/types";
|
||||
import { App, SKBKit } from "@/shared/types/app";
|
||||
export const transformPostsToCardData = (
|
||||
posts: App.ProjectPost[]
|
||||
): Record<string, CardData> => {
|
||||
return posts.reduce((acc, post) => {
|
||||
acc[post.id] = {
|
||||
id: post.id.toString(),
|
||||
name: post.title,
|
||||
previewText: post.previewText || "",
|
||||
link: `/post/${post.id}`,
|
||||
preview: post.preview || "",
|
||||
};
|
||||
return acc;
|
||||
}, {} as Record<string, CardData>);
|
||||
};
|
||||
export const transformNewsToCardData = (
|
||||
news: SKBKit.News[]
|
||||
): Record<string, CardData> => {
|
||||
return news.reduce((acc, item) => {
|
||||
acc[item.id] = {
|
||||
id: item.id,
|
||||
name: item.heading,
|
||||
previewText: "", // Если нужно можно вырезать часть текста из preview
|
||||
link: `/news/${item.id}`,
|
||||
preview: item.preview || "",
|
||||
};
|
||||
return acc;
|
||||
}, {} as Record<string, CardData>);
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
// pages/MainPage/ui/MainPage/Lists.tsx
|
||||
import { CardList } from "@/widgets/CardList/CardList";
|
||||
import { GridConfig } from "@/widgets/CardList/types";
|
||||
import { usePosts } from "@/modules/posts/hooks/usePosts";
|
||||
import styles from "./CardList.module.scss";
|
||||
import { useNews } from "@/modules";
|
||||
import {
|
||||
transformNewsToCardData,
|
||||
transformPostsToCardData,
|
||||
} from "@/pages/CardListPages/CardListFunctions";
|
||||
|
||||
interface ListProps {
|
||||
gridConfig?: GridConfig;
|
||||
}
|
||||
|
||||
const NewsList = ({
|
||||
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
|
||||
}: ListProps) => {
|
||||
const { data: newsData, isLoading, isError } = useNews();
|
||||
console.log(newsData);
|
||||
if (isLoading)
|
||||
return (
|
||||
<div className="mainContainer">
|
||||
<h2 className={styles.title}>Новости</h2>
|
||||
<span className="loader"></span>
|
||||
</div>
|
||||
);
|
||||
if (isError) return <div>Ошибка при загрузке данных</div>;
|
||||
return (
|
||||
<div className={styles.mainContainer}>
|
||||
{newsData && (
|
||||
<CardList
|
||||
items={transformNewsToCardData(newsData)}
|
||||
variant="news"
|
||||
gridConfig={gridConfig}
|
||||
title="Новости"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const LabsList = ({
|
||||
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
|
||||
}: ListProps) => {
|
||||
const { data: postsData, isLoading, isError } = usePosts();
|
||||
const labs = postsData?.labs ? Object.values(postsData.labs) : [];
|
||||
if (isLoading)
|
||||
return (
|
||||
<div className="mainContainer">
|
||||
<h2 className={styles.title}>Лаборатории</h2>
|
||||
<span className="loader"></span>
|
||||
</div>
|
||||
);
|
||||
if (isError) return <div>Ошибка при загрузке данных</div>;
|
||||
return (
|
||||
<div className={styles.mainContainer}>
|
||||
<CardList
|
||||
items={transformPostsToCardData(labs)}
|
||||
variant="lab"
|
||||
gridConfig={gridConfig}
|
||||
title="Лаборатории"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const ProjectsList = ({
|
||||
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
|
||||
}: ListProps) => {
|
||||
const { data: postsData, isError, isLoading } = usePosts();
|
||||
const projects = postsData?.projects ? Object.values(postsData.projects) : [];
|
||||
if (isLoading)
|
||||
return (
|
||||
<div className="mainContainer">
|
||||
<h2 className={styles.title}>Проекты</h2>
|
||||
<span className="loader"></span>
|
||||
</div>
|
||||
);
|
||||
if (isError) return <div>Ошибка при загрузке данных</div>;
|
||||
return (
|
||||
<div className={styles.mainContainer}>
|
||||
<CardList
|
||||
items={transformPostsToCardData(projects)}
|
||||
variant="project"
|
||||
gridConfig={gridConfig}
|
||||
title="Проекты"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { NewsList, LabsList, ProjectsList };
|
||||
@@ -1,44 +0,0 @@
|
||||
import { YMaps, Map, Placemark } from '@pbe/react-yandex-maps';
|
||||
|
||||
import { PageContent, PageHeader } from "../components";
|
||||
import ContactForm from "../../components/ContactForm";
|
||||
|
||||
import "./Contact.styles.scss";
|
||||
|
||||
function Contact() {
|
||||
return (
|
||||
<div id="page-contact">
|
||||
<PageHeader>
|
||||
<div className="top-block">
|
||||
<div>
|
||||
<h1>Контакты</h1>
|
||||
<div className="contact">
|
||||
<p>Контактное лицо:<br />
|
||||
Кутковой Владимир Сергеевич<br />
|
||||
Руководитель СКБ «КИТ»<br />
|
||||
Email: skb@sfedu.ru<br />
|
||||
Адрес: г. Таганрог, пер. Тургеневский, 44, ауд. 208</p>
|
||||
</div>
|
||||
</div>
|
||||
<YMaps>
|
||||
<Map
|
||||
defaultState={{
|
||||
center: [47.206690, 38.929113],
|
||||
zoom: 13,
|
||||
controls: ["zoomControl", "fullscreenControl"],
|
||||
}}
|
||||
modules={["control.ZoomControl", "control.FullscreenControl"]}
|
||||
>
|
||||
<Placemark defaultGeometry={[47.206690, 38.929113]} />
|
||||
</Map>
|
||||
</YMaps>
|
||||
</div>
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
<ContactForm />
|
||||
</PageContent>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Contact;
|
||||
@@ -1,52 +1,51 @@
|
||||
@import "../../components/ContactForm/ContactForm.styles.scss";
|
||||
@import "../../widgets/ContactForm/ContactForm.styles.scss";
|
||||
|
||||
#page-contact {
|
||||
.top-block {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
flex: 1 1 50%;
|
||||
.top-block {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
flex: 1 1 50%;
|
||||
|
||||
margin-bottom: 2em;
|
||||
//margin-top: 48px;
|
||||
@media (max-width: 768px) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div:has(> ymaps) {
|
||||
|
||||
ymaps[class*="inner-panes"] {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
// div:has(> ymaps)
|
||||
div:has(> ymaps)>* {
|
||||
width: auto !important;
|
||||
height: 100% !important;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
margin-bottom: 2em;
|
||||
margin-top: 48px;
|
||||
@media (max-width: 768px) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.contact-form {
|
||||
.row {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.submit-container {
|
||||
margin: 0;
|
||||
max-width: 35%;
|
||||
}
|
||||
}
|
||||
|
||||
.row>* {
|
||||
flex: 1 1 calc(50% - ($gap / 2));
|
||||
}
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
div:has(> ymaps) {
|
||||
ymaps[class*="inner-panes"] {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
// div:has(> ymaps)
|
||||
div:has(> ymaps) > * {
|
||||
width: auto !important;
|
||||
height: 100% !important;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.contact-form {
|
||||
.row {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.submit-container {
|
||||
margin: 0;
|
||||
max-width: 35%;
|
||||
}
|
||||
}
|
||||
|
||||
.row > * {
|
||||
flex: 1 1 calc(50% - ($gap / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { YMaps, Map, Placemark } from "@pbe/react-yandex-maps";
|
||||
|
||||
import "./Contact.styles.scss";
|
||||
import ContactForm from "@/widgets/ContactForm";
|
||||
|
||||
function Contact() {
|
||||
return (
|
||||
<div id="page-contact" className="mainContainer">
|
||||
<div className="top-block">
|
||||
<div>
|
||||
<h1>Контакты</h1>
|
||||
<div className="contact">
|
||||
<p>
|
||||
Контактное лицо:
|
||||
<br />
|
||||
Кутковой Владимир Сергеевич
|
||||
<br />
|
||||
Руководитель СКБ «КИТ»
|
||||
<br />
|
||||
Email: skb@sfedu.ru
|
||||
<br />
|
||||
Адрес: г. Таганрог, пер. Тургеневский, 44, ауд. 208
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<YMaps>
|
||||
<Map
|
||||
defaultState={{
|
||||
center: [47.20669, 38.929113],
|
||||
zoom: 13,
|
||||
controls: ["zoomControl", "fullscreenControl"],
|
||||
}}
|
||||
modules={["control.ZoomControl", "control.FullscreenControl"]}
|
||||
>
|
||||
<Placemark defaultGeometry={[47.20669, 38.929113]} />
|
||||
</Map>
|
||||
</YMaps>
|
||||
</div>
|
||||
|
||||
<ContactForm />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Contact;
|
||||
Executable → Regular
File renamed without changes.
@@ -1,19 +0,0 @@
|
||||
import { useRouteError } from 'react-router-dom'
|
||||
|
||||
export default function ErrorPage() {
|
||||
const error = useRouteError()
|
||||
console.error(error)
|
||||
|
||||
return (
|
||||
<div
|
||||
className="align-items-center bg-white d-flex flex-column flex-grow-1 justify-content-center"
|
||||
id="error-page"
|
||||
>
|
||||
<h1 className="mt-0">Oops!</h1>
|
||||
<p className="text-break text-center" >Sorry, an unexpected error has occurred.</p>
|
||||
<p>
|
||||
<i>{error.statusText || error.message}</i>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './ErrorPage';
|
||||
@@ -1,17 +0,0 @@
|
||||
import { PageHeader, PageContent } from "../components";
|
||||
import { LabList } from "../../components"
|
||||
|
||||
function Labs() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader className="header">
|
||||
<h1>Лаборатории</h1>
|
||||
</PageHeader>
|
||||
<PageContent className="content">
|
||||
<LabList />
|
||||
</PageContent>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Labs;
|
||||
@@ -1,29 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { PagePost } from "../../components";
|
||||
import { getLabByID } from "../../../api";
|
||||
|
||||
function Lab() {
|
||||
const [lab, setLab] = useState();
|
||||
|
||||
const params = useParams();
|
||||
const labID = params.id;
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newLab = await getLabByID(labID);
|
||||
setLab(newLab);
|
||||
console.log('newLab', newLab);
|
||||
};
|
||||
loadData();
|
||||
}, [labID]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{lab && <PagePost post={lab} isLab={true} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Lab;
|
||||
Loaded 100 of 331 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user