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

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

-30
View File
@@ -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;
+5
View File
@@ -0,0 +1,5 @@
import { CategoryPage } from "@/widgets/CategoryPage/CategoryPage";
export default function AboutUs() {
return <CategoryPage category="aboutus" />;
}
View File
File renamed without changes.
+190
View File
@@ -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>);
};
+93
View File
@@ -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 };
-44
View File
@@ -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;
+45 -46
View File
@@ -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));
}
}
}
+45
View File
@@ -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;
View File
File renamed without changes.
-19
View File
@@ -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
View File
@@ -1 +0,0 @@
export { default } from './ErrorPage';
-17
View File
@@ -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;
-29
View File
@@ -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;
-1
View File
@@ -1 +0,0 @@
export { default as Lab } from "./Lab";
-1
View File
@@ -1 +0,0 @@
export { default } from './Labs';
-49
View File
@@ -1,49 +0,0 @@
import { useContext, useEffect } from 'react';
import { HashLink } from 'react-router-hash-link';
import { News, Projects, Labs, Partners, Gallery, ContactUs } from './components';
import { RootContext } from '../Root';
import { PageContent, PageHeader } from '../components';
// import { scb_blue as logo_02 } from '../../assets/images';
import './Main.styles.scss';
function Main() {
const { setRef } = useContext(RootContext);
useEffect(() => {
const navbar = document.getElementById("navbar");
if (navbar) {
navbar.classList.add('transparent');
}
return () => {
if (navbar) {
navbar.classList.remove('transparent');
}
}
}, [])
return (
<>
<PageHeader id="mainpageheader" ref={element => setRef(element)}>
<div className="container">
<h1>Думай иначе, будь креативным!</h1>
<h2>Студенческое конструкторское бюро<br />
"Компьютерное инновационное творчество"</h2>
<HashLink smooth to="#contact-us" className="btn">Связаться с нами</HashLink>
</div>
</PageHeader>
<PageContent><br />
<News />
<Projects />
<Labs />
<Partners />
<Gallery />
<ContactUs />
</PageContent>
</>
);
}
export default Main;
-241
View File
@@ -1,241 +0,0 @@
@import "../../assets/styles/theme.scss";
$news-card-gap: 1em;
body {
overflow-x: hidden; // Скрываем горизонтальный скролл
}
#react-page:has(> #mainpageheader) {
margin-top: 0;
#mainpageheader {
position: relative;
overflow: hidden;
min-height: 100vh;
padding: 0 10%;
margin: 0;
color: $text-secondary;
background-image: url(/assets/images/art.bmp);
background-color: $bg-image;
background-blend-mode: multiply;
background-position: center;
background-size: cover;
.container {
position: absolute;
top: 40%;
display: flex;
flex-direction: column;
@media (max-width: 768px) {
top: 30%;
padding: $navbar-padding-tb 5%;
}
h1 {
font-size: 52px;
font-weight: 600;
line-height: 63px;
margin: 0;
margin-bottom: 24px;
@media (max-width: 768px) {
font-size: 32px;
line-height: 40px;
}
}
h2 {
font-size: 24px;
font-weight: 400;
line-height: 36px;
@media (max-width: 768px) {
font-size: 24px;
line-height: 28px;
}
}
.btn {
margin: 0;
margin-top: 24px;
}
}
}
.block {
background: transparent !important;
h1 {
font-family: Montserrat;
font-size: 36px;
font-weight: 600;
margin-top: 0;
margin-bottom: 1.5rem;
@media (max-width: 768px) {
font-size: 24px;
}
}
.heading {
display: flex;
justify-content: space-between;
align-items: center;
a {
font-size: 20px;
font-weight: 500;
text-align: right;
color: $text-primary;
@media (max-width: 768px) {
font-size: 16px;
}
}
}
#news-list .row {
grid-template-columns: repeat(4, calc((100% - $news-card-gap * 3) / 4));
justify-content: space-between;
gap: $news-card-gap;
}
}
.block:not(:last-child) {
margin-bottom: 32px;
}
@media (max-width: 768px) {
#mainpageheader {
padding: 0;
}
}
.block:not(:last-child) {
margin-bottom: 32px;
}
@media (max-width: 768px) {
#mainpageheader {
padding: 0;
}
}
#news-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 0%;
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;
transform: translateX(-12.6%);
@media (max-width: 768px) {
display: none;
}
}
.row .card {
width: calc(25% - $news-card-gap); // 4 карточки в ряд
aspect-ratio: 1 / 0.8973; // Карточка всегда квадратная
@media (max-width: 768px) {
width: 100%; // 1 карточка в ряд на мобильных
margin-bottom: 1em;
}
}
}
.project-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 35%;
left: 0;
width: 100%; // Увеличиваем ширину на 10%, чтобы занять отступ
height: 465px;
background-image: url('../../assets/images/backround/bg_projects_block.svg');
background-repeat: no-repeat;
background-position: right center;
background-size: contain; // Или cover, если нужно заполнить область
z-index: -1;
transform: translateX(11.5%); // Смещаем влево, компенсируя padding
@media (max-width: 768px) {
display: none; // Скрываем картинку на мобильных
}
}
}
.row.lab-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 10%;
left: 0;
width: 100%; // Увеличиваем ширину на 10%, чтобы занять отступ
height: 436px;
background-image: url('../../assets/images/backround/bg_labs_block.svg');
background-repeat: no-repeat;
background-position: left center;
background-size: contain; // Или cover, если нужно заполнить область
z-index: -1;
transform: translateX(-11.8%); // Смещаем влево, компенсируя padding
@media (max-width: 768px) {
display: none; // Скрываем картинку на мобильных
}
}
}
#gallery {
margin-left: 0;
margin-right: 0;
position: relative;
&::before {
content: "";
position: absolute;
top: 35%;
left: 0;
width: 100%;
height: 307px;
background-image: url('../../assets/images/backround/bg_gallery_block.svg');
background-repeat: no-repeat;
background-position: right center;
background-size: contain;
z-index: -1;
transform: translateX(12.5%);
@media (max-width: 768px) {
display: none;
}
}
}
}
@@ -1,14 +0,0 @@
import { Link } from 'react-router-dom';
function BlockHeading({ heading, link, linkText }) {
return (
<div className="heading">
<h1>{heading}</h1>
{link && linkText &&
<Link to={link}>{linkText}</Link>// убрала стрелочку &rarr;
}
</div>
);
}
export default BlockHeading;
@@ -1 +0,0 @@
export { default } from './BlockHeading';
@@ -1,16 +0,0 @@
import ContactForm from "../../../../components/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,36 +0,0 @@
#contact-us {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
gap: 60px;
.half {
flex: 1 1 50%;
}
.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;
}
.contact-form {
max-width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
}
}
@@ -1 +0,0 @@
export { default } from './ContactUs';
@@ -1,16 +0,0 @@
import Slider from '../../../../components/Slider';
import './Gallery.styles.scss';
function Gallery() {
return (
<div id="gallery"><br /><br />
<h1>СКБ «КИТ» - реальные технологические<br />
проекты под руководством наставников<br />
из университета и бизнеса.</h1>
<Slider />
</div>
);
}
export default Gallery;
@@ -1,20 +0,0 @@
#react-page .content #gallery {
margin-left: 0;
margin-right: 0;
h1 {
width: 80%;
margin-left: auto;
margin-right: auto;
font-size: 28px;
font-weight: 400;
line-height: 35px;
letter-spacing: 0em;
text-align: center;
@media (max-width: 768px) {
font-size: 22px;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
import BlockHeading from '../BlockHeading';
import { LabList } from '../../../../components';
function Labs() {
return (
<div className="block" id="labs">
<BlockHeading heading="Наши лаборатории" />
<LabList />
</div>
);
}
export default Labs;
-1
View File
@@ -1 +0,0 @@
export { default } from './Labs';
-15
View File
@@ -1,15 +0,0 @@
import BlockHeading from '../BlockHeading';
import NewsList from '../../../../components/News';
function News() {
return (
<>
<div className="block" id="news">
<BlockHeading heading='Новости' linkText='Все новости' link='/news' />
<NewsList isMainPage={ true } />
</div>
</>
);
}
export default News;
-1
View File
@@ -1 +0,0 @@
export { default } from './News';
@@ -1,56 +0,0 @@
import { useState, useEffect } from 'react';
import Marquee from 'react-fast-marquee';
import BlockHeading from '../BlockHeading';
import PartnersLogo from './PartnersLogo';
import { getMedia } from '../../../../api';
import './Partners.styles.scss';
import { scb } from '../../../../assets/images';
import { porsche } from '../../../../assets/images/partners';
const mock = [
{ src: porsche },
{ src: scb },
];
function Partners({ partners = mock }) {
const [mediaList, setMediaList] = useState(partners);
const [play, setPlay] = useState(false);
useEffect(() => {
const loadData = async () => {
const newMediaList = await getMedia('partners');
setMediaList(newMediaList);
if (newMediaList.length >= 5) {
setPlay(true);
};
}
loadData();
}, []);
return (
<div className="block" id="partners">
<BlockHeading heading="Наши партнеры" />
<div className="marquee-container">
<Marquee
gradient={false}
pauseOnHover={false}
play={play}
speed={80}
className="marquee"
autoFill={play}
>
{mediaList.map((item, index) => (
<div key={index} className="partner">
<PartnersLogo partner={item} />
</div>
))}
</Marquee>
</div>
</div>
);
}
export default Partners;
@@ -1,44 +0,0 @@
$block-height: 150px;
$logo-size: 150px;
#react-page .content #partners {
margin-left: 0;
margin-right: 0;
margin-bottom: $block-height !important;
.marquee-container {
position: absolute;
left: 0;
width: 100%;
height: $block-height;
overflow: hidden;
.marquee {
height: 100%;
display: flex;
align-items: center;
.rfm-marquee {
justify-content: 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; //
//object-fit: contain;
pointer-events: none;
}
}
}
}
}
@@ -1,9 +0,0 @@
function PartnersLogo({ partner }) {
return (
<div className="partner">
<img src={ partner.src } alt="" className="logo" />
</div>
);
}
export default PartnersLogo;
@@ -1 +0,0 @@
export { default } from './Partners';
@@ -1,15 +0,0 @@
import BlockHeading from '../BlockHeading';
import ProjectList from '../../../../components/Projects';
import './Projects.styles.scss';
function Projects() {
return (
<div className="block" id="projects">
<BlockHeading heading="Наши проекты" linkText="Все проекты" link="/projects" />
<ProjectList />
</div>
);
}
export default Projects;
@@ -1,11 +0,0 @@
@import "../../../../assets/styles/theme.scss";
#projects {
.row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 32px;
}
}
@@ -1 +0,0 @@
export { default } from './Projects';
-6
View File
@@ -1,6 +0,0 @@
export { default as News } from './News';
export { default as Projects } from './Projects';
export { default as Labs } from './Labs';
export { default as Partners } from './Partners';
export { default as Gallery } from './Gallery';
export { default as ContactUs } from './ContactUs';
-1
View File
@@ -1 +0,0 @@
export { default } from './Main';
+5
View File
@@ -0,0 +1,5 @@
import { MainPageAsync } from './ui/MainPage/MainPage.async';
export {
MainPageAsync as MainPage,
};
@@ -0,0 +1,3 @@
import { lazy } from "react";
export const MainPageAsync = lazy(() => import("./MainPage"));
@@ -0,0 +1,236 @@
.mainContainer {
margin: 30px 10% 0 10%;
@include mediaMax($mobile-xs-width) {
margin: 30px 5% 0 5%;
}
}
$news-card-gap: 1em;
body {
overflow-x: hidden; // Скрываем горизонтальный скролл
}
#mainpageheader {
position: relative;
overflow: hidden;
min-height: 100vh;
padding: 0 10%;
margin: 0;
margin-bottom: 20px;
color: $text-secondary;
background-image: url("/src/shared/assets/images/art.bmp");
background-color: $bg-image;
background-blend-mode: multiply;
background-position: center;
background-size: cover;
.container {
position: absolute;
top: 40%;
display: flex;
flex-direction: column;
@media (max-width: 768px) {
top: 30%;
padding: $navbar-padding-tb 5%;
}
h1 {
font-size: 52px;
font-weight: 600;
line-height: 63px;
margin: 0;
margin-bottom: 24px;
@media (max-width: 768px) {
font-size: 32px;
line-height: 40px;
}
}
h2 {
font-size: 24px;
font-weight: 400;
line-height: 36px;
@media (max-width: 768px) {
font-size: 24px;
line-height: 28px;
}
}
.btn {
margin: 0;
margin-top: 24px;
}
}
}
.block {
background: transparent !important;
h1 {
font-family: Montserrat;
font-size: 36px;
font-weight: 600;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
@media (max-width: 768px) {
font-size: 24px;
}
}
.heading {
display: flex;
justify-content: space-between;
align-items: center;
a {
font-size: 20px;
font-weight: 500;
text-align: right;
color: $text-primary;
@media (max-width: 768px) {
font-size: 16px;
}
}
}
#news-list .row {
grid-template-columns: repeat(4, calc((100% - $news-card-gap * 3) / 4));
justify-content: space-between;
gap: $news-card-gap;
}
}
.block:not(:last-child) {
margin-bottom: 32px;
}
@media (max-width: 768px) {
#mainpageheader {
padding: 0;
}
}
.block:not(:last-child) {
margin-bottom: 32px;
}
@media (max-width: 768px) {
#mainpageheader {
padding: 0;
}
}
#news-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 0%;
left: 0;
width: 100%;
height: 364px;
background-image: url("/src/shared/assets/images/backround/bg_news_block.svg");
background-repeat: no-repeat;
background-position: left center;
background-size: contain;
z-index: -1;
transform: translateX(-12.6%);
@media (max-width: 768px) {
display: none;
}
}
.row .card {
width: calc(25% - $news-card-gap); // 4 карточки в ряд
aspect-ratio: 1 / 0.8973; // Карточка всегда квадратная
@media (max-width: 768px) {
width: 100%; // 1 карточка в ряд на мобильных
margin-bottom: 1em;
}
}
}
.project-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 35%;
left: 0;
width: 100%; // Увеличиваем ширину на 10%, чтобы занять отступ
height: 465px;
background-image: url("/src/shared/assets/images/backround/bg_projects_block.svg");
background-repeat: no-repeat;
background-position: right center;
background-size: contain; // Или cover, если нужно заполнить область
z-index: -1;
transform: translateX(11.3%); // Смещаем влево, компенсируя padding
@media (max-width: 768px) {
display: none; // Скрываем картинку на мобильных
}
}
}
.row.lab-list {
position: relative;
&::before {
content: "";
position: absolute;
top: 10%;
left: 0;
width: 100%; // Увеличиваем ширину на 10%, чтобы занять отступ
height: 436px;
background-image: url("/src/shared/assets/images/backround/bg_labs_block.svg");
background-repeat: no-repeat;
background-position: left center;
background-size: contain; // Или cover, если нужно заполнить область
z-index: -1;
transform: translateX(-11.6%); // Смещаем влево, компенсируя padding
@media (max-width: 768px) {
display: none; // Скрываем картинку на мобильных
}
}
}
#gallery {
margin-left: 0;
margin-right: 0;
position: relative;
&::before {
content: "";
position: absolute;
top: 35%;
left: 0;
width: 100%;
height: 307px;
background-image: url("/src/shared/assets/images/backround/bg_gallery_block.svg");
background-repeat: no-repeat;
background-position: right center;
background-size: contain;
z-index: -1;
transform: translateX(12.5%);
@media (max-width: 768px) {
display: none;
}
}
}
@@ -0,0 +1,56 @@
import styles from "./MainPage.module.scss";
import { HashLink } from "react-router-hash-link";
import { useContext, useEffect } from "react";
import { RootContext } from "@/app/Layout/Root";
import Partners from "@/widgets/Partners";
import Gallery from "@/pages/MainPage/ui/components/Gallery";
import ContactUs from "@/widgets/ContactUs";
import {
LabsList,
NewsList,
ProjectsList,
} from "@/pages/CardListPages/CardListPages";
const MainPage = () => {
const { setRef } = useContext(RootContext);
useEffect(() => {
const navbar = document.getElementById("navbar");
if (navbar) {
navbar.classList.add("transparent");
}
return () => {
if (navbar) {
navbar.classList.remove("transparent");
}
};
}, []);
return (
<div>
<div id={styles.mainpageheader} ref={(element) => setRef(element)}>
<section className={styles.container}>
<h1>Думай иначе, будь креативным!</h1>
<h2>
Студенческое конструкторское бюро
<br />
"Компьютерное инновационное творчество"
</h2>
<HashLink smooth to="#contact-us" className={"btn " + styles.btn}>
Связаться с нами
</HashLink>
</section>
</div>
<NewsList />
<ProjectsList />
<LabsList />
<div className={styles.mainContainer}>
<Partners />
<Gallery />
<ContactUs />
</div>
</div>
);
};
export default MainPage;
@@ -0,0 +1,46 @@
import labMock from "@/shared/assets/images/labMock.jpeg";
export const labItems = {
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,
},
};
@@ -0,0 +1,20 @@
#gallery {
margin-left: 0;
margin-right: 0;
h1 {
width: 80%;
margin-left: auto;
margin-right: auto;
font-size: 28px;
font-weight: 400;
line-height: 35px;
letter-spacing: 0em;
text-align: center;
@media (max-width: 768px) {
font-size: 22px;
}
}
}
@@ -0,0 +1,21 @@
import Slider from "@/widgets/Slider/Slider";
import "./Gallery.styles.scss";
function Gallery() {
return (
<div id="gallery">
<br />
<br />
<h1>
СКБ «КИТ» - реальные технологические
<br />
проекты под руководством наставников
<br />
из университета и бизнеса.
</h1>
<Slider />
</div>
);
}
export default Gallery;
-18
View File
@@ -1,18 +0,0 @@
import { PageHeader, PageContent } from "../components";
import { LoadMore, NewsList } from "../../components";
import "./News.styles.scss";
function News() {
return (
<>
<PageHeader className="header">
<h1>Новости</h1>
</PageHeader>
<PageContent id="news-page">
<NewsList />
</PageContent>
</>
);
}
export default News;
-39
View File
@@ -1,39 +0,0 @@
$news-card-gap: 1em;
#news-page #news-list .row {
padding-top: 0.5em; // Отступ сверху для новостей
padding-bottom: 2em; // Отступ снизу для кнопки
/* Устанавливаем, что первая карточка будет шириной 2/3 */
.card:first-child {
width: calc(66.666% - $news-card-gap); // Первая карточка будет шириной 2/3 от контейнера
aspect-ratio: 5 / 1;
@media (max-width: 768px) {
width: 100%;
}height: 325px;
.pic .label {
font-size: clamp(18px, 2vw, 28px);
@media (max-width: 768px) {
font-size: 20px;
}
}
}
/* Для последующих карточек (на второй и третьей позиции) в первой строке */
.card:nth-child(2), .card:nth-child(3) {
width: calc(33.333% - $news-card-gap);
aspect-ratio: 3 / 2.6;height: 325px;
@media (max-width: 768px) {
width: 100%;
}
}
/* Для всех остальных строк карточки остаются по 3 штуки в строке */
.card:nth-child(n+4) {
width: calc(33.333% - $news-card-gap);
aspect-ratio: 3 / 2.6;height: 325px;
@media (max-width: 768px) {
width: 100%;
}
}
}
-64
View File
@@ -1,64 +0,0 @@
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { PageContent, PageHeader } from "../../components";
import { getNewsByID, vkWallUrl } from "../../../api";
import { Slider } from "../../../components";
import { extLink, views } from "../../../assets/images";
import "./NewsItem.styles.scss";
function NewsItem() {
const [news, setNews] = useState();
const params = useParams();
const newsID = params.id;
function formatDate(timestamp) {
const date = new Date(timestamp * 1000);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0');
const year = date.getFullYear();
return `${day}.${month}.${year}`; // DD.MM.YYYY
}
useEffect(() => {
const loadData = async () => {
const newItem = await getNewsByID(newsID);
console.log('newItem.views', newItem.views);
console.log('newItem.date', newItem.date);
newItem.date = formatDate(newItem.date);
setNews(newItem);
};
loadData();
}, [newsID]);
const newsUrl = `${vkWallUrl}_${newsID}`;
return (
<>
{news &&
<>
<PageHeader className="header">
<h1>{news.heading}</h1>
</PageHeader>
<PageContent className="content" id="news-item-page">
{news.photos.length !== 0 && <Slider images={news.photos} variant="news"/>}
{news.text.map(textRow => <p dangerouslySetInnerHTML={{ __html: textRow }}></p>)}
<div className="row">
<p><a href={newsUrl} target="_blank" rel="noreferrer">Ссылка на новость <img class="icon" src={extLink} alt="" /></a></p>
<div id="right">
<p><img class="icon" src={views} alt="" />{news.views}</p>
<p id="date">Дата публикации: {news.date}</p>
</div>
</div>
</PageContent>
</>
}
</>
);
}
export default NewsItem;
@@ -1,33 +0,0 @@
@import "../../../assets/styles/theme.scss";
#news-item-page .row {
display: flex;
justify-content: space-between;
margin-top: 2em;
>* {
display: inline-block;
width: fit-content;
}
.icon {
height: $main-font-size;
}
#right {
text-align: right;
color: rgb(100, 100, 100);
.icon {
margin-right: 0.5em;
}
p {
display: inline-block;
}
#date {
margin-left: 1em;
}
}
}
-1
View File
@@ -1 +0,0 @@
export { default as Lab } from './NewsItem';
-1
View File
@@ -1 +0,0 @@
export { default } from "./News.jsx";
+31
View File
@@ -0,0 +1,31 @@
#news-item-page .row {
display: flex;
justify-content: space-between;
margin-top: 2em;
> * {
display: inline-block;
width: fit-content;
}
.icon {
height: $main-font-size;
}
#right {
text-align: right;
color: rgb(100, 100, 100);
.icon {
margin-right: 0.5em;
}
p {
display: inline-block;
}
#date {
margin-left: 1em;
}
}
}
+69
View File
@@ -0,0 +1,69 @@
import { useParams } from "react-router-dom";
import extLink from "@/shared/assets/images/extLink.svg";
import views from "@/shared/assets/images/views.svg";
import "./NewsItem.styles.scss";
import { useNewsById } from "@/modules/news/hooks/useNewsById";
import { PageContent, PageHeader } from "@/widgets/PostPage";
import Slider from "@/widgets/Slider/Slider";
export const vkWallUrl = "https://vk.com/skbkit?w=wall-172789021";
function NewsItem() {
const params = useParams();
const newsID = params.id;
const { data: news, isLoading, isError } = useNewsById(newsID || "");
const formatDate = (timestamp: number) => {
const date = new Date(timestamp * 1000);
const day = String(date.getDate()).padStart(2, "0");
const month = String(date.getMonth() + 1).padStart(2, "0");
const year = date.getFullYear();
return `${day}.${month}.${year}`; // DD.MM.YYYY
};
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
</div>
);
if (isError) return <div>Ошибка при загрузке новости</div>;
const newsUrl = `${vkWallUrl}_${newsID}`;
return (
<>
{news && (
<>
<PageHeader className="header">
<h1>{news.heading}</h1>
</PageHeader>
<PageContent className="content" id="news-item-page">
{news.photos.length !== 0 && <Slider images={news.photos} />}
{news.text.map((textRow, index) => (
<p key={index} dangerouslySetInnerHTML={{ __html: textRow }} />
))}
<div className="row">
<p>
<a href={newsUrl} target="_blank" rel="noreferrer">
Ссылка на новость{" "}
<img className="icon" src={extLink} alt="" />
</a>
</p>
<div id="right">
<p>
<img className="icon" src={views} alt="" />
{news.views}
</p>
<p id="date">Дата публикации: {formatDate(news.date)}</p>
</div>
</div>
</PageContent>
</>
)}
</>
);
}
export default NewsItem;
+3
View File
@@ -0,0 +1,3 @@
export const NotFoundPage = () => {
return <div>Такой страницы нету</div>;
};
-17
View File
@@ -1,17 +0,0 @@
import { PageContent, PageHeader } from "../components";
import { ProjectList } from "../../components"
function Projects() {
return (
<>
<PageHeader className="header">
<h1>Проекты</h1>
</PageHeader>
<PageContent className="content">
<ProjectList />
</PageContent>
</>
);
}
export default Projects;
-32
View File
@@ -1,32 +0,0 @@
import { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import { PagePost } from "../../components";
import { getProjectByID } from "../../../api";
import "./Project.styles.scss";
function Project() {
const [project, setProject] = useState();
const params = useParams();
const projectID = params.id;
useEffect(() => {
const loadData = async () => {
const newProject = await getProjectByID(projectID);
setProject(newProject);
console.log('newProject', newProject);
};
loadData();
}, [projectID]);
return (
<>
{project && <PagePost post={project} />}
</>
);
}
export default Project;
@@ -1 +0,0 @@
@import "./uniqueStyles/Project.TrashSensor.styles.scss";
-1
View File
@@ -1 +0,0 @@
export { default as Project } from "./Project";
@@ -1,69 +0,0 @@
$color-highlight: #072AC8;
$table-header-color: #EEEEEE;
$table-body-bg: #ffffff;
$color-usual: #ACACAC;
$border-raduis: 16px;
.table-wrapper {
border: 1px solid $table-header-color;
border-radius: $border-raduis;
overflow-x: auto;
background: $table-header-color;
.comparison-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
font-size: 20px;
th,
td {
max-width: 200px;
border: none;
padding: 12px 16px;
vertical-align: middle;
background: $table-body-bg;
}
tr:not(:last-child) th,
tr:not(:last-child) td {
border-bottom: 1px solid $table-header-color;
}
tr:last-child th,
tr:last-child td {
border-bottom: 1px solid $table-body-bg;
}
thead th {
background-color: $table-header-color;
font-weight: 400;
padding: 12px 16px;
border:none;
}
tbody td:not(:first-child),
thead th:not(:first-child) {
text-align: center;
}
thead th.highlight {
font-weight: 600;
font-size: 24px;
border-radius: 10px 10px 0 0;
border-bottom: 1px solid $color-highlight;
color: #ffffff;
background-color: $color-highlight;
}
tbody td.highlight {
border: 1px solid $color-highlight;
border-top: none;
.icon {
filter: brightness(0) saturate(100%) invert(26%) sepia(94%) saturate(2350%) hue-rotate(225deg) brightness(95%) contrast(93%);
}
}
}
}
-1
View File
@@ -1 +0,0 @@
export { default } from './Projects';
-85
View File
@@ -1,85 +0,0 @@
import { Outlet } from "react-router-dom";
import { createContext, useEffect, useState } from 'react';
import useElementOnScreen from '../../lib/useElementOnScreen';
import ScrollToTop from "../../lib/scrollToTop";
import Navbar from '../../components/Navbar';
import Footer from '../../components/Footer';
import './Root.styles.scss';
import { up } from '../../assets/images';
export const RootContext = createContext();
function Root() {
const [setRef, isTargetVisible] = useElementOnScreen({
root: null,
rootMargin: '0px',
threshold: 0.9,
});
const [isOnTopVisible, setIsOnTopVisible] = useState(false); // Состояние для видимости кнопки
const [hasScrolled, setHasScrolled] = useState(false); // Новый флаг для отслеживания прокрутки
// Для навбара
useEffect(() => {
const navbar = document.getElementById('navbar');
if (isTargetVisible) {
if (navbar) {
navbar.classList.add('transparent');
}
} else {
if (navbar) {
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'
});
};
return (
<RootContext.Provider value={{ setRef }}>
<ScrollToTop />
<Navbar />
<div id="react-page">
<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;
-163
View File
@@ -1,163 +0,0 @@
@import "../../assets/styles/theme.scss";
// Общий стиль
#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;
}
}
.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; // Скрыть кнопку на мобильных устройствах
}
}
-1
View File
@@ -1 +0,0 @@
export { default as Root, RootContext } from './Root';
+28
View File
@@ -0,0 +1,28 @@
import { usePostById } from "@/modules";
import { PagePost } from "@/widgets/PostPage";
import { useParams } from "react-router-dom";
function PostPage() {
const params = useParams();
const postId = params.id ? parseInt(params.id, 10) : null;
if (!postId) {
return <div>Не указан ID поста</div>;
}
const { data: post, isLoading, isError } = usePostById(postId);
if (isLoading) {
return (
<div className="mainContainer">
<span className="loader"></span>
</div>
);
}
if (isError) {
return <div>Ошибка при загрузке данных</div>;
}
console.log('post', post);
return <>{post && <PagePost post={post} isLab={false} />}</>;
}
export default PostPage;
-9
View File
@@ -1,9 +0,0 @@
function PageContent({ children, id = "" }) {
return (
<div className="content" id={id}>
{ children }
</div>
);
}
export default PageContent;
-11
View File
@@ -1,11 +0,0 @@
import { forwardRef } from "react";
const PageHeader = forwardRef(({ children, id }, ref) => {
return (
<header id={id} ref={ref} className="header">
{children}
</header>
);
});
export default PageHeader;
-53
View File
@@ -1,53 +0,0 @@
import { useEffect } from "react";
import { PageHeader, PageContent } from "../components";
import { MediaBlock, ProjectList } from "../../components";
import "./PagePost.styles.scss";
function PagePost({ post, isLab = false }) {
const resizeObserver = new ResizeObserver((entries) => {
entries.forEach((entry) => {
const parent = entry.target;
const blockquoteElement = parent.querySelector('blockquote');
if (blockquoteElement) {
const blockquoteHeight = blockquoteElement.offsetHeight;
parent.style.marginBottom = `calc(${blockquoteHeight}px + 2em)`;
}
})
});
const setQuotesProps = () => {
const parentElements = document.querySelectorAll('.wp-block-pullquote');
parentElements.forEach((tapeElement) => {
resizeObserver.observe(tapeElement);
});
};
useEffect(() => {
setQuotesProps();
}, []);
return (
<div className={post.tag === 'custom' ? "custom" : ""}>
<PageHeader className="header">
<h1>{typeof post !== 'undefined' && post.name}</h1>
</PageHeader>
<PageContent className="content">
{typeof post !== 'undefined' && typeof post.content !== 'string' &&
post.content.map(el => {
if (el.type === 'mediablock') {
return <MediaBlock images={el.value} />;
}
return el;
})
}
{post && isLab && <ProjectList laboratory={post.tag} />}
</PageContent>
</div>
);
}
export default PagePost;
-75
View File
@@ -1,75 +0,0 @@
$background-tape: #F5F5F7;
:root {
--wp--preset--spacing--10: 5%;
--wp--preset--spacing--20: 10%;
--wp--preset--spacing--30: 15%;
--wp--preset--spacing--40: 20%;
--wp--preset--spacing--50: 25%;
--wp--preset--spacing--60: 30%;
}
.content>h1,
.content>h2,
.content>h3 {
margin-bottom: 1em;
}
.custom {
.header {
text-align: center;
margin-bottom: 4em;
}
}
.wp-block-columns {
margin-bottom: 2em;
}
.is-layout-flex {
display: flex;
justify-content: space-between;
gap: 2em;
figure {
img {
max-width: 100%;
height: auto;
object-fit: contain !important; // Wordpress накидывает styles к элементу, приходится перебивать
}
}
}
.has-text-align-center {
text-align: center;
}
.has-text-align-justify {
text-align: justify;
}
.is-style-rounded * {
border-radius: 16px;
}
.wp-block-pullquote {
* {
margin-bottom: 0;
}
blockquote {
display: flex;
justify-content: center;
position: absolute;
left: 0;
width: 100%;
padding: 16px 0;
background: $background-tape;
p {
display: inline-block;
max-width: 40%;
text-align: center;
}
}
}
-3
View File
@@ -1,3 +0,0 @@
export { default as PageHeader } from "./PageHeader";
export { default as PageContent } from "./PageContent";
export { default as PagePost } from "./PagePost";
-8
View File
@@ -1,8 +0,0 @@
export { Root } from './Root';
export { default as ErrorPage} from './ErrorPage';
export { default as Main } from './Main';
export { default as AboutUs } from './AboutUs';
export { default as Labs } from './Labs';
export { default as Projects } from './Projects';
export { default as Contact } from './Contact';
export { default as News } from './News';