перенес структуру Севы со своими правками

This commit is contained in:
ifraimka1 committed 2025-04-01 15:25:46 +03:00
1 parent 3a1cac0dfe
commit 808d97eb4b
331 files changed
+12260 -19950

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
button {
padding: 0.5rem 1rem;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
background-color: #07a8e3;
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
color: rgba(0, 0, 0, 0.7);
font-family: Kumbh Sans;
font-size: 16px;
font-weight: 300;
line-height: 140%;
letter-spacing: 1%;
text-align: center;
color: #fff;
&:hover {
background-color: #07a8e3;
}
}
+18
View File
@@ -0,0 +1,18 @@
import styles from "./Button.module.scss";
interface ButtonProps {
label: string;
className?: string;
onClick?: () => void; // Добавляем onClick как необязательный пропс
}
export const Button = ({ label, className, onClick }: ButtonProps) => {
return (
<button
className={className + ' ' + styles.button}
onClick={onClick} // Используем onClick для кнопки
>
{label}
</button>
);
};
+173
View File
@@ -0,0 +1,173 @@
.card {
position: relative;
display: block;
border-radius: 8px;
overflow: hidden;
transition: all 0.3s ease;
&__lab {
height: 300px;
border: 1px solid transparent;
color: $text-secondary;
.content {
position: absolute;
bottom: 10px;
left: 20px;
right: 20px;
z-index: 2;
transition: bottom 0.3s ease;
}
.description {
max-height: 0;
opacity: 0;
transition: max-height 0.3s ease, opacity 0.3s ease;
overflow: hidden;
}
.link {
opacity: 0;
transition: opacity 0.3s ease;
}
&:hover {
.image {
filter: brightness(0.7);
}
.content {
bottom: 20px;
}
.description {
max-height: 200px;
opacity: 1;
}
.link {
opacity: 1;
}
}
}
&__news {
height: 250px;
.content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 12px 16px;
color: white;
&::before {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 40%;
background: linear-gradient(
to top,
rgba(0, 0, 0, 0.6),
rgba(0, 0, 0, 0)
);
z-index: -1;
}
}
}
&__project {
height: 250px;
.content {
position: absolute;
left: 11px;
bottom: 0;
padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
color: $text-card-project;
}
}
}
.image {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
transition: filter 0.3s ease;
}
.title {
margin: 0 0 12px;
font-size: clamp(1.25rem, 1.0011rem + 0.5199vw, 1.625rem);
font-weight: 600;
}
.description {
p {
font-size: clamp(1rem, 0.8755rem + 0.26vw, 1.1875rem);
line-height: 140%;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
}
margin: 0;
}
.link {
font-size: clamp(12px, 1.5vw, 20px);
font-weight: 500;
}
@media (max-width: 768px) {
.card {
height: 215px !important;
&--lab {
.content {
left: 10px;
right: 10px;
}
}
}
.card__lab {
&:hover {
.title {
font-size: 20px;
@include mediaMax($mobile-max-widthGosBlock) {
font-size: 16px;
}
}
}
}
.title {
font-size: 22px;
@include mediaMax($mobile-max-widthGosBlock) {
font-size: 20px;
}
}
.description {
p {
font-size: 16px;
line-height: 26px;
@include mediaMax($mobile-max-widthGosBlock) {
font-size: 15px;
line-height: 22px;
}
}
}
.link {
font-size: 18px;
@include mediaMax($mobile-max-widthGosBlock) {
font-size: 16px;
}
}
}
+38
View File
@@ -0,0 +1,38 @@
// widgets/Card/Card.tsx
import { Link } from "react-router-dom";
import styles from "./Card.module.scss";
import { classNames } from "@/shared/lib/classNames/classNames";
import type { CardData } from "@/widgets/CardList/types";
interface CardProps {
data: CardData & { variant?: "lab" | "news" | "project" };
}
export const Card = ({ data }: CardProps) => {
const { id, name, previewText, preview, link, variant = "lab" } = data;
return (
<Link
className={classNames(styles.card, {}, [styles[`card__${variant}`]])}
to={link || `/${id || name}`}
>
<img src={preview} alt={name} className={styles.image} />
<div className={styles.content}>
<h3 className={styles.title}>{name}</h3>
{previewText && variant === "lab" && (
<div className={styles.description}>
<p>{previewText}</p>
</div>
)}
{variant === "lab" && (
<div className={styles.link}>
<span>Перейти ⟶</span>
</div>
)}
</div>
</Link>
);
};
+14
View File
@@ -0,0 +1,14 @@
// Тип для вариантов карточки
export interface CardData {
id?: string; // Опционально, если используется name как уникальный идентификатор
name: string; // Название лаборатории
previewText: string; // Описание
link: string; // Ссылка
preview: string; // URL изображения
variant?: "lab" | "news" | "project"; // Вариант карточки
}
// Пропсы компонента Card
export interface CardProps {
data: CardData;
}
+48
View File
@@ -0,0 +1,48 @@
.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;
}
}
.list {
display: grid;
gap: 2rem;
width: 100%;
max-width: 100%;
box-sizing: border-box;
margin-bottom: 32px;
&__lab {
grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
@include mediaMax($desktop-small-width) {
grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
}
@include mediaMax($tablet-max-width) {
grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
}
}
&__news {
grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
@include mediaMax($desktop-small-width) {
grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
}
@include mediaMax($tablet-max-width) {
grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
}
}
&__project {
grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
@include mediaMax($desktop-small-width) {
grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
}
@include mediaMax($tablet-max-width) {
grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
}
}
}
+34
View File
@@ -0,0 +1,34 @@
// widgets/CardList/CardList.tsx
import { CardListProps } from "@/widgets/CardList/types";
import styles from "./CardList.module.scss";
import { Card } from "@/widgets/Card/Card";
import { classNames } from "@/shared/lib/classNames/classNames";
export const CardList = ({
items,
variant = "lab", // Значение по умолчанию
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
title = "Лаборатории",
}: CardListProps) => {
const itemsArray = Object.values(items);
return (
<div>
<h1 className={styles.title}>{title}</h1>
<div
className={classNames(styles.list, {}, [styles[`list__${variant}`]])}
style={
{
"--desktop-columns": gridConfig.desktop,
"--tablet-columns": gridConfig.tablet,
"--mobile-columns": gridConfig.mobile,
} as React.CSSProperties
}
>
{itemsArray.map((item) => (
<Card key={item.id || item.name} data={{ ...item, variant }} />
))}
</div>
</div>
);
};
+22
View File
@@ -0,0 +1,22 @@
// widgets/CardList/types.ts
export interface GridConfig {
desktop: number;
tablet: number;
mobile: number;
}
export interface CardData {
id?: string; // Опционально, если используется name как уникальный идентификатор
name: string; // Название лаборатории
previewText: string; // Описание
link: string; // Ссылка
preview: string; // URL изображения
variant?: "lab" | "news" | "project"; // Вариант карточки
}
export interface CardListProps {
items: Record<string, CardData>; // Объект объектов
variant?: "lab" | "news" | "project";
gridConfig?: GridConfig;
title: string;
}
+31
View File
@@ -0,0 +1,31 @@
import { usePosts } from "@/modules/posts/hooks/usePosts";
import { PagePost } from "@/widgets/PostPage";
interface CategoryPageProps {
category: string;
}
export function CategoryPage({ category }: CategoryPageProps) {
const { data: postsData, isLoading, isError } = usePosts();
const categoryPosts =
postsData?.other.filter((post) => post.categories.includes(category)) || [];
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
</div>
);
if (isError) return <div>Ошибка при загрузке данных</div>;
return (
<>
{categoryPosts.map((post) => (
<PagePost key={post.id} post={post}>
<div className="btn">Показать еще</div>
</PagePost>
))}
</>
);
}
@@ -0,0 +1,136 @@
$gap: 20px;
$icon-size: 24px;
$color-file-button: rgb(7, 42, 200);
.contact-form {
padding: 20px 22px;
border-radius: 16px;
height: 100%;
width: 100%;
background-color: $bg-form;
margin-top: 20px;
h2 {
margin-top: 0;
min-width: 400px;
font-size: 28px;
font-weight: 500;
line-height: 44px;
@media (max-width: 768px) {
font-size: 20px;
min-width: 0;
}
}
.smart-captcha {
min-width: 0;
}
.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;
}
}
}
}
+178
View File
@@ -0,0 +1,178 @@
import { useCallback } from "react";
import { Form } from "react-router-dom";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { SmartCaptcha } from "@yandex/smart-captcha";
import { useContactForm } from "@/modules/contact/hooks/useContactForm";
import "./ContactForm.styles.scss";
import Field from "@/shared/Components/Field";
import {
ALLOWED_FILE_TYPES,
MAX_FILE_SIZE,
} from "@/widgets/ContactForm/variables";
const formSchema = z.object({
name: z.string().min(1, "Обязательное поле"),
email: z.string().email("Некорректный email. Пример 123@sfedu.ru"),
message: z.string().min(1, "Обязательное поле"),
file: z
.any() // Используем `any`, чтобы избежать ошибки типа
.optional()
.nullable()
.refine(
(file) => !file || file.length === 0 || file instanceof File, // Проверяем, что это File, если значение есть
"Файл должен быть экземпляром File"
)
.refine(
(file) => !file || file.length === 0 || file.size <= MAX_FILE_SIZE,
"Файл слишком большой (макс. 10МБ)"
)
.refine(
(file) =>
!file || file.length === 0 || ALLOWED_FILE_TYPES.includes(file.type),
"Недопустимый формат файла"
)
.transform((value) => value ?? undefined),
captcha: z.string().min(1, "Требуется проверка капчи"),
});
type FormData = z.infer<typeof formSchema>;
function ContactForm() {
const {
register,
handleSubmit,
setValue,
watch,
formState: { errors, isSubmitting },
reset,
trigger,
} = useForm<FormData>({
resolver: zodResolver(formSchema),
defaultValues: {
name: "",
email: "",
message: "",
file: undefined,
captcha: "",
},
});
const { mutate: submitForm, isPending } = useContactForm();
const file = watch("file");
const fileAttached = !!file && file instanceof File;
console.log(file);
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
const selectedFile = e.target.files?.[0];
setValue("file", selectedFile || undefined, { shouldValidate: true });
await trigger("file");
};
const handleRemoveFile = () => {
setValue("file", undefined, { shouldValidate: true });
};
const handleCaptchaChange = useCallback(
(token: string) => {
setValue("captcha", token);
},
[setValue]
);
const handleTokenExpired = useCallback(() => {
setValue("captcha", "");
}, [setValue]);
const onSubmit = async (data: FormData) => {
const formData = new FormData();
formData.append("name", data.name);
formData.append("email", data.email);
formData.append("message", data.message);
formData.append("captcha", data.captcha);
if (data.file instanceof File) {
formData.append("file", data.file);
}
submitForm(formData, {
onSuccess: () => {
alert("Сообщение отправлено!");
reset();
},
onError: () => {
alert("Ошибка отправки.");
},
});
};
return (
<Form
method="post"
onSubmit={handleSubmit(onSubmit)}
className="half contact-form"
>
<h2>Свяжитесь с нами!</h2>
<div className="inputs">
<Field
type="text"
name="name"
placeholder="Имя"
disabled={isSubmitting || isPending}
register={register("name")}
error={errors.name?.message}
/>
<Field
type="email"
name="email"
placeholder="E-mail"
disabled={isSubmitting || isPending}
register={register("email")}
error={errors.email?.message}
/>
<Field
type="textarea"
name="message"
placeholder="Опишите в этом поле свой проект и, по возможности, прикрепите файл с ТЗ"
disabled={isSubmitting || isPending}
register={register("message")}
error={errors.message?.message}
/>
<Field
type="file"
name="file"
disabled={isSubmitting || isPending}
fileAttached={fileAttached}
handleRemoveFile={handleRemoveFile}
register={register("file", {
onChange: handleFileChange,
})}
error={errors.file?.message}
/>
<div className="submit-container">
{watch("captcha") ? (
<Field
type="submit"
name="submit"
disabled={isSubmitting || isPending}
/>
) : (
<div className="captcha-container">
<SmartCaptcha
sitekey="ysc1_8nFqhYasby2fJ9J7pCTxdBMe0Xc3Y6CrWk4aylB03d4f0045"
onSuccess={handleCaptchaChange}
onTokenExpired={handleTokenExpired}
/>
</div>
)}
</div>
</div>
</Form>
);
}
export default ContactForm;
+1
View File
@@ -0,0 +1 @@
export { default } from './ContactForm';
+9
View File
@@ -0,0 +1,9 @@
export const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
export const ALLOWED_FILE_TYPES = [
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text/plain",
"application/pdf",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
];
@@ -0,0 +1,30 @@
#contact-us {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
gap: 60px;
.half {
flex: 1 1 50%;
width: 100%;
}
.contact-form {
flex: 1 1 35%;
.row {
flex-direction: column;
}
}
}
@media (max-width: 768px) {
#contact-us {
gap: 0;
flex-direction: column; // Ставим элементы в колонку
align-items: stretch; // Центрируем контент
width: 100%; // Убедимся, что блок занимает всю ширину
margin: 0;
padding: 0;
}
}
+19
View File
@@ -0,0 +1,19 @@
import ContactForm from "@/widgets/ContactForm";
import "./ContactUs.styles.scss";
function ContactUs() {
return (
<>
<br />
<div className="block" id="contact-us">
<h1 className="half">
Нужна помощь?
<br /> Команда способных IT-специалистов готова вам помочь!
</h1>
<ContactForm />
</div>
</>
);
}
export default ContactUs;
+1
View File
@@ -0,0 +1 @@
export { default } from './ContactUs';
+130
View File
@@ -0,0 +1,130 @@
#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: 70%;
max-width: 30%;
.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");
}
+87
View File
@@ -0,0 +1,87 @@
import { useState } from "react";
import FooterLink from "./FooterLink";
import FooterContacts from "./FooterContacts";
import logo from "@/shared/assets/images/scb.svg";
import iconIctis from "@/shared/assets/images/footer/iconIctis.png";
import iconSfedu from "@/shared/assets/images/footer/iconSfedu.png";
import iconVK from "@/shared/assets/images/footer/iconVK.svg";
import "./Footer.styles.scss";
// Тип для ссылок
interface LinkType {
src: string;
to: string;
id?: string; // Добавляем опциональное поле id
}
// Тип для контактов
interface ContactsType {
email: JSX.Element;
address: JSX.Element;
phone: JSX.Element;
}
// Тип для пропсов компонента Footer
interface FooterProps {
links?: Record<string, LinkType>; // Объект с ключами-строками и значениями типа LinkType
contacts?: ContactsType;
}
const mockLinks: Record<string, LinkType> = {
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: ContactsType = {
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 }: FooterProps) {
const [mediaList] = useState(links);
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((linkKey) => (
<FooterLink link={mediaList[linkKey]} key={linkKey} />
))}
</div>
</footer>
);
}
export default Footer;
+20
View File
@@ -0,0 +1,20 @@
// Тип для пропсов компонента FooterContacts
interface FooterContactsProps {
contacts: {
email: JSX.Element;
address: JSX.Element;
phone: JSX.Element;
};
}
function FooterContacts({ contacts }: FooterContactsProps) {
return (
<div className="contacts">
<p>{contacts.email}</p>
<p>{contacts.address}</p>
<p>{contacts.phone}</p>
</div>
);
}
export default FooterContacts;
+19
View File
@@ -0,0 +1,19 @@
import { Link } from "react-router-dom";
// Тип для пропсов компонента FooterLink
interface FooterLinkProps {
link: {
src: string;
to: string;
};
}
function FooterLink({ link }: FooterLinkProps) {
return (
<Link to={link.to} className="link" target="_blank">
<img src={link.src} alt="icon" className="icon" />
</Link>
);
}
export default FooterLink;
+1
View File
@@ -0,0 +1 @@
export { default } from './Footer';
@@ -0,0 +1,22 @@
$media-gap: 1em;
$row-limit: 2;
.media-block {
display: flex;
flex-wrap: wrap;
gap: $media-gap;
margin: 2em auto;
.media-container {
flex: 1 1 calc((100% / $row-limit) - ($media-gap * $row-limit));
.image {
display: block;
box-sizing: border-box;
object-fit: contain;
max-width: 100%;
width: 100%;
max-height: 100%;
}
}
}
+14
View File
@@ -0,0 +1,14 @@
import MediaContainer from "@/widgets/MediaBlock/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;
@@ -0,0 +1,9 @@
function MediaContainer({ src }) {
return (
<div className="media-container">
<img className="image" alt="" src={src} />
</div>
);
}
export default MediaContainer;
@@ -0,0 +1 @@
export { default } from './MediaContainer';
+1
View File
@@ -0,0 +1 @@
export { default } from "./MediaBlock";
+140
View File
@@ -0,0 +1,140 @@
#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;
flex-wrap: wrap;
justify-content: flex-end;
.nav-link {
font-size: 16px;
font-weight: 500;
line-height: 20px;
letter-spacing: 0em;
padding: 0.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;
}
}
}
@media (max-width: 768px) {
height: $navbar-height;
padding: $navbar-padding-tb 5%;
.nav-link:has(> .logo) .logo {
width: $navbar-logo-mini-height;
}
}
}
+115
View File
@@ -0,0 +1,115 @@
import { useState, useEffect } from "react";
import NavbarLink from "./NavbarLink";
import logo from "@/shared/assets/images/sсb_blue.svg";
import "./Navbar.styles.scss";
// Тип для ссылок
interface LinkType {
text: string;
to: string;
newTab?: boolean; // Опциональное поле для открытия ссылки в новой вкладке
onClick?: () => void; // Опциональное поле для обработчика клика
}
// Тип для пропсов компонента Navbar
interface NavbarProps {
links?: LinkType[];
}
const mock: LinkType[] = [
{
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 }: NavbarProps) {
const [isOpen, setIsOpen] = useState(false);
const [navbarHidden, setNavbarHidden] = useState(false); // true = спрятан, false = виден
const [lastScrollTop, setLastScrollTop] = useState(0);
const THRESHOLD = 400; // navbar не скрывается в первые 400px
const toggleMenu = () => {
setIsOpen(!isOpen);
};
const handleLinkClick = () => {
setIsOpen(false); // Закрываем меню при клике на ссылку
};
// Для навбара
useEffect(() => {
const navbar = document.getElementById("navbar");
if (navbarHidden && !isOpen && navbar) {
navbar.classList.add("hidden");
} else if (navbar) {
navbar.classList.remove("hidden");
}
}, [navbarHidden, isOpen]);
useEffect(() => {
const handleScroll = () => {
const currentScrollTop = window.pageYOffset;
if (currentScrollTop <= THRESHOLD) {
setNavbarHidden(false);
} else {
if (currentScrollTop > lastScrollTop) {
setNavbarHidden(true);
} else {
setNavbarHidden(false);
}
}
setLastScrollTop(currentScrollTop);
};
window.addEventListener("scroll", handleScroll);
return () => window.removeEventListener("scroll", handleScroll);
}, [lastScrollTop]);
return (
<div id="navbar">
<NavbarLink className="logo-container" link={{ to: "/" }}>
<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;
+36
View File
@@ -0,0 +1,36 @@
import { NavLink } from "react-router-dom";
import { Children, ReactNode } from "react";
// Тип для пропсов компонента NavbarLink
interface NavbarLinkProps {
link: {
text?: string; // Опциональное поле для текста ссылки
to: string;
newTab?: boolean;
onClick?: () => void;
};
children?: ReactNode; // Дочерние элементы
className?: string; // Опциональное поле для класса
}
function NavbarLink({ link, children, className }: NavbarLinkProps) {
return (
<NavLink
className={({ isActive, isPending }) =>
`nav-link ${className || ""} ${
isActive ? "active" : isPending ? "disabled" : ""
}`
}
to={link.to}
target={link.newTab ? "_blank" : undefined}
onClick={link.onClick}
>
{link.text}
{Children.map(children, (child) => (
<>{child}</>
))}
</NavLink>
);
}
export default NavbarLink;
+1
View File
@@ -0,0 +1 @@
export { default } from './Navbar';
+51
View File
@@ -0,0 +1,51 @@
$block-height: 150px;
$logo-size: 150px;
#partners {
margin-left: 0;
margin-right: 0;
margin-bottom: $block-height !important;
.heading {
display: flex;
justify-content: space-between;
align-items: center;
h1 {
font-family: Montserrat;
font-size: 36px;
font-weight: 600;
margin-bottom: 1.5rem;
margin-top: 0;
@include mediaMax($tablet-max-width) {
font-size: 24px;
}
}
}
.marquee__container {
position: absolute;
left: 0;
width: 100%;
height: $block-height;
overflow: hidden;
.marquee {
height: 100%;
display: flex;
align-items: center;
}
}
.partner {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
margin: 0 8px;
.logo {
width: $logo-size;
height: $logo-size;
border-radius: 50%;
object-fit: cover;
pointer-events: none;
}
}
}
+115
View File
@@ -0,0 +1,115 @@
import { useState, useEffect } from "react";
import Marquee from "react-fast-marquee";
import PartnersLogo from "./PartnersLogo";
import styles from "./Partners.module.scss";
import BlockHeading from "@/widgets/BlockHeading";
// Тип для данных партнёра
interface Partner {
src: string;
}
// Пропсы для компонента Partners
interface PartnersProps {
partners?: Partner[];
}
const mock: Partner[] = [
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/bmw-m4-bright-headlights-close-up-g7qtwp90l3u3c0vv-scaled.jpg",
},
{
src: "https://test.skbkit.ru/wp-content/uploads/2025/03/partners_sundowner.gif",
},
];
function Partners({ partners = mock }: PartnersProps) {
const [mediaList, setMediaList] = useState<Partner[]>(partners);
const updateMediaList = async () => {
// Логика для обновления списка медиа
// const newMediaList = await getMedia('partners');
// setMediaList(newMediaList);
};
useEffect(() => {
updateMediaList();
window.addEventListener("resize", updateMediaList);
return () => {
window.removeEventListener("resize", updateMediaList);
};
}, []);
return (
<div className={styles.block} id={styles.partners}>
<div className={styles.heading}>
<h1>Наши партнеры</h1>
</div>
<div className={styles.marquee__container}>
<Marquee
gradient={false}
pauseOnHover={false}
speed={80}
className={styles.marquee}
>
{mediaList.map((item, index) => (
<div key={index} className={styles.partner}>
<PartnersLogo partner={item} />
</div>
))}
</Marquee>
</div>
</div>
);
}
export default Partners;
+16
View File
@@ -0,0 +1,16 @@
import styles from "./Partners.module.scss"; // Пропсы для компонента PartnersLogo
interface PartnersLogoProps {
partner: {
src: string;
};
}
function PartnersLogo({ partner }: PartnersLogoProps) {
return (
<div className={styles.partner}>
<img src={partner.src} alt="" className={styles.logo} />
</div>
);
}
export default PartnersLogo;
+1
View File
@@ -0,0 +1 @@
export { default } from './Partners';
+19
View File
@@ -0,0 +1,19 @@
import { ReactNode } from "react";
interface PageContentProps {
children?: ReactNode;
id?: string;
className?: string;
}
export default function PageContent({
children,
id = "",
className,
}: PageContentProps) {
return (
<div className={className} id={id}>
{children}
</div>
);
}
+25
View File
@@ -0,0 +1,25 @@
import { forwardRef } from "react";
import { ForwardedRef, ReactNode } from "react";
interface PageHeaderProps {
children?: ReactNode;
id?: string;
className?: string;
}
const PageHeader = forwardRef(
(
{ children, id, className }: PageHeaderProps,
ref: ForwardedRef<HTMLDivElement>
) => {
return (
<div id={id} ref={ref} className={className}>
{children}
</div>
);
}
);
PageHeader.displayName = "PageHeader";
export default PageHeader;
+36
View File
@@ -0,0 +1,36 @@
import { ReactNode } from "react";
import MediaBlock from "@/widgets/MediaBlock/MediaBlock";
import { PageContent, PageHeader } from "@/widgets/PostPage";
import { App } from "@/shared/types/app";
interface PagePostProps {
post: App.ProjectPost;
isLab?: boolean;
children?: ReactNode;
}
export default function PagePost({
post,
children,
}: PagePostProps) {
return (
<>
<PageHeader className="header">
<h1>{post.title}</h1>
</PageHeader>
<PageContent className="content">
{Array.isArray(post.content) &&
post.content.map((el, index) => {
if (el.type === "mediablock") {
return <MediaBlock key={index} images={el.value} />;
}
return <div key={index}>{el.element}</div>;
})}
{children}
</PageContent>
</>
);
}
+3
View File
@@ -0,0 +1,3 @@
export { default as PageHeader } from "./PageHeader";
export { default as PageContent } from "./PageContent";
export { default as PagePost } from "./PagePost";
+79
View File
@@ -0,0 +1,79 @@
.slider {
width: 100%;
margin: 0 auto;
position: relative;
padding: 10px 0;
.swiper-slide {
display: flex;
justify-content: center;
align-items: center;
height: 50vh;
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;
}
}
}
}
/* стрелки */
.swiper-button-prev,
.swiper-button-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;
&::after {
font-size: 18px;
font-weight: 1000;
color: black;
}
}
/* Позиционирование стрелок */
.swiper-button-prev {
left: 5px;
@media (max-width: 768px) {
left: 0px;
}
}
.swiper-button-next {
right: 5px;
@media (max-width: 768px) {
right: 0px;
}
}
+98
View File
@@ -0,0 +1,98 @@
import { useEffect, useState } from "react";
import { Swiper, SwiperSlide } from "swiper/react";
import { Navigation, Pagination } from "swiper/modules";
import { useMedia } from "@/modules/media/hooks/useMedia";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
import "./Slider.styles.scss";
interface SliderProps {
autoPlay?: boolean;
autoPlayTime?: number;
images?: string[];
category?: string;
}
function Slider({
autoPlay = false,
autoPlayTime = 3000,
images,
category = "gallery",
}: SliderProps) {
const { data: mediaData, isLoading, isError } = useMedia();
const [itemsPerSlide, setItemsPerSlide] = useState(
window.innerWidth <= 768 ? 1 : 2
);
const [enableButtons, setEnableButtons] = useState(false);
// Фильтруем медиа по категории
const filteredMedia = images
? images.map((src, id) => ({ id, src }))
: mediaData?.filter((media) => media.category === category) || [];
console.log(mediaData);
useEffect(() => {
const handleResize = () => {
setItemsPerSlide(window.innerWidth <= 768 ? 1 : 2);
};
window.addEventListener("resize", handleResize);
return () => window.removeEventListener("resize", handleResize);
}, []);
useEffect(() => {
const numberOfSlides = filteredMedia.length;
if (numberOfSlides > 2) {
setEnableButtons(true);
} else if (numberOfSlides === 1) {
setItemsPerSlide(1);
}
}, [filteredMedia]);
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
</div>
);
if (isError) return <div>Ошибка при загрузке медиа</div>;
return (
<div className="slider">
<Swiper
modules={[Navigation, Pagination]}
spaceBetween={20}
slidesPerView={itemsPerSlide}
slidesPerGroup={1}
loop={enableButtons}
navigation={enableButtons}
pagination={{ clickable: enableButtons }}
autoplay={
autoPlay
? { delay: autoPlayTime, disableOnInteraction: false }
: false
}
>
{filteredMedia.map((media) => (
<SwiperSlide
key={media.id}
className={
filteredMedia.length === 1
? "swiper-slide single"
: "swiper-slide"
}
>
<img
src={media.src}
alt={`slide-${media.id}`}
className="slide-image"
/>
</SwiperSlide>
))}
</Swiper>
</div>
);
}
export default Slider;
@@ -0,0 +1,42 @@
@import "../../../assets/styles/theme.scss";
.arrows {
position: absolute;
z-index: 1;
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
left: 0;
right: 0;
margin: 0 auto;
.arrow {
display: flex;
justify-content: center;
align-items: center;
height: 60px;
width: 60px;
padding-right: 5px;
border-radius: 100%;
background: $bg-primary;
box-shadow: 0px 4px 4px 0px $shadow-primary;
font-size: 30px;
box-sizing: border-box;
&:hover {
cursor: pointer;
}
&.left {
left: 0; /* Прижимаем левую кнопку к краю */
}
&.right {
right: 0; /* Прижимаем правую кнопку к краю */
transform: rotateY(180deg);
}
}
}
+22
View File
@@ -0,0 +1,22 @@
import React, { useContext } from "react";
import { SliderContext } from "../Slider";
import { arrow } from '../../../assets/images';
import './Arrows.styles.scss';
function Arrows() {
const { changeSlide } = useContext(SliderContext);
return (
<div className="arrows">
<div className="arrow left" onClick={() => changeSlide(-1)}>
<img src={ arrow } alt="" />
</div>
<div className="arrow right" onClick={() => changeSlide(1)}>
<img src={ arrow } alt="" />
</div>
</div>
);
}
export default Arrows;
+16
View File
@@ -0,0 +1,16 @@
import { useContext } from "react";
import { SliderContext } from "../Slider";
function Dot({ number }) {
const { goToSlide, slideNumber } = useContext(SliderContext);
return (
<div
className={`dot ${slideNumber === number ? "selected" : ""}`}
onClick={() => goToSlide(number)}
/>
);
}
export default Dot;
+21
View File
@@ -0,0 +1,21 @@
import { useContext } from "react";
import { SliderContext } from "../Slider";
import Dot from "./Dots";
function Dots() {
const { slidesCount } = useContext(SliderContext);
const renderDots = () => {
const dots = [];
for (let i = 0; i < slidesCount; i++) {
dots.push(<Dot key={`dot-${i}`} number={i} />);
}
return dots;
};
return <div className="dots">{renderDots()}</div>;
}
export default Dots;
+7
View File
@@ -0,0 +1,7 @@
export default function Slide({ slide }) {
return (
<div className="slide">
<img src={slide} className="slide-image" />
</div>
);
}
@@ -0,0 +1,18 @@
import { useContext } from "react";
import Slide from "./Slide";
import { SliderContext } from "../Slider";
export default function SlidesList() {
const { slideNumber, mediaList } = useContext(SliderContext);
return (
<div
className="slide-list"
style={{ transform: `translateX(-${slideNumber * 100}%)` }}
>
{mediaList.map((slide, index) => (
<Slide key={index} slide={slide.src} />
))}
</div>
);
}
+2
View File
@@ -0,0 +1,2 @@
export { default as Arrows } from './Arrows';
export { default as SlidesList } from './SlidesList';
+1
View File
@@ -0,0 +1 @@
export { default } from './Slider';