подчёркивание ссылок в footer

This commit is contained in:
xomimishka committed 2025-05-07 15:37:25 +03:00
commit 5a72249518
41 files changed
+1338 -340

No files matched your search

+2 -3
View File
@@ -2,14 +2,13 @@
@import "global";
@import "variables/variables";
@import "reset";
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');
@font-face {
font-family: "Montserrat";
font-family: 'Montserrat', sans-serif;
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("../fonts/Montserrat/Montserrat-VariableFont_wght.ttf")
format("truetype");
}
.app {
min-height: 100%;
+7 -1
View File
@@ -1,3 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');
input {
border: none;
}
@@ -16,7 +18,7 @@ body,
input,
textarea,
button {
font-family: Montserrat;
font-family: 'Montserrat', sans-serif;
}
code {
@@ -95,6 +97,10 @@ header h1 {
}
}
h2 {
margin-bottom: 1em;
}
#root {
display: flex;
min-height: 100vh;
@@ -1,7 +1,7 @@
.mainContainer {
margin: 30px 10% 0 10%;
margin: 0 10% 0 10%;
@include mediaMax($mobile-xs-width) {
margin: 30px 5% 0 5%;
margin: 0 5% 0 5%;
}
}
@@ -72,7 +72,7 @@ body {
background: transparent !important;
h1 {
font-family: Montserrat;
font-family: 'Montserrat', sans-serif;
font-size: 36px;
font-weight: 600;
@@ -202,4 +202,11 @@ body {
display: none;
}
}
}
}
.mainpage-container {
display: flex;
flex-direction: column;
margin-top: 40px;
gap: 40px;
}
+18 -16
View File
@@ -43,22 +43,24 @@ const MainPage = () => {
</HashLink>
</section>
</div>
<ProjectsList />
<div className={styles.NumbersContainer}>
<Numbers />
</div>
<NewsList />
<div className={styles.GalleryContainer}>
<Gallery />
</div>
<div className={styles.LabListContainer}>
<LabsList />
</div>
<div className={styles.mainContainer}>
<Partners />
</div>
<div className={styles.mainContainer}>
<ContactUs />
<div className={styles.mainpageContainer}>
<ProjectsList />
<div className={styles.NumbersContainer}>
<Numbers />
</div>
<NewsList />
<div className={styles.GalleryContainer}>
<Gallery />
</div>
<div className={styles.LabListContainer}>
<LabsList />
</div>
<div className={styles.mainContainer}>
<Partners />
</div>
<div className={styles.mainContainer}>
<ContactUs />
</div>
</div>
</div>
);
+5 -2
View File
@@ -2,6 +2,7 @@ import { useParams } from "react-router-dom";
import extLink from "@/shared/assets/images/extLink.svg";
import views from "@/shared/assets/images/views.svg";
import {SkeletonPost} from "@/shared/Components/SkeletonPost/SkeletonPost";
import "./NewsItem.styles.scss";
import { useNewsById } from "@/modules/news/hooks/useNewsById";
@@ -25,10 +26,12 @@ function NewsItem() {
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
{[...Array(1)].map((_, index) => (
<SkeletonPost key={index} />
))}
</div>
);
if (isError) return <div>Ошибка при загрузке новости</div>;
if (isError) return <center>Ошибка при загрузке новости</center>;
const newsUrl = `${vkWallUrl}_${newsID}`;
+5 -2
View File
@@ -2,6 +2,7 @@ import { usePostById } from "@/modules";
import { WpPost } from "@/widgets/WpPost";
import { useParams } from "react-router-dom";
import { ProjectsList } from "@/widgets/CardList/CardList";
import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost";
function WpPostPage() {
const params = useParams();
@@ -16,13 +17,15 @@ function WpPostPage() {
if (isLoading) {
return (
<div className="mainContainer">
<span className="loader"></span>
{[...Array(1)].map((_, index) => (
<SkeletonPost key={index} />
))}
</div>
);
}
if (isError) {
return <div>Ошибка при загрузке данных</div>;
return <center>Ошибка при загрузке данных</center>;
}
console.log('post', post);
return (<>
@@ -0,0 +1,88 @@
.card {
position: relative;
width: 100%;
height: 250px;
border-radius: 8px;
background-color: #e0e0e0;
overflow: hidden;
@media (max-width: 768px) {
height: 215px !important;
}
}
.pic {
width: 100%;
height: 100%;
border-radius: 8px;
background-color: #ddd;
position: relative;
}
.shimmer {
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%);
animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
0% {
left: -150%;
}
100% {
left: 150%;
}
}
.labsCard {
height: 300px;
@media (max-width: 768px) {
height: 215px !important;
}
}
.titleSkeleton {
margin: 0 10%;
@include mediaMax($mobile-xs-width) {
margin: 0 5%;
}
height: 40px;
width: 25.3%;
border-radius: 4px;
background-color: #e0e0e0;
position: relative;
overflow: hidden;
margin-bottom: 16px;
@media (max-width: 768px) {
height: 32px;
width: 70%;
margin-bottom: 16px;
}
}
.titleSkeleton::after {
content: "";
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
@@ -0,0 +1,23 @@
// shared/Components/SkeletonCard/SkeletonCard.tsx
import styles from "./SkeletonCard.module.scss";
interface SkeletonCardProps {
variant?: "default" | "lab";
}
const SkeletonCard = ({ variant = "default" }: SkeletonCardProps) => {
const cardClass =
variant === "lab"
? `${styles.card} ${styles.labsCard}`
: styles.card;
return (
<div className={cardClass}>
<div className={styles.pic}>
<div className={styles.shimmer}></div>
</div>
</div>
);
};
export default SkeletonCard;
@@ -0,0 +1,15 @@
.skeletonGrid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
width: 100%;
margin: 0 10%;
@media (max-width: 768px) {
grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 769px) and (max-width: 1024px) {
grid-template-columns: repeat(2, 1fr);
}
}
@@ -0,0 +1,32 @@
import React from "react";
import SkeletonCard from "./SkeletonCard";
import styles from "@/shared/styles/cardGrid.module.scss";
interface SkeletonGridProps {
count?: number;
gridConfig?: { desktop: number; tablet: number; mobile: number };
variant?: "default" | "lab";
}
export const SkeletonGrid = ({
count = 3,
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
variant = "default",
}: SkeletonGridProps) => {
return (
<div className={styles.mainContainer}>
<div
className={styles.gridСontainer}
style={{
"--desktop-columns": gridConfig.desktop,
"--tablet-columns": gridConfig.tablet,
"--mobile-columns": gridConfig.mobile,
} as React.CSSProperties}
>
{[...Array(count)].map((_, index) => (
<SkeletonCard key={index} variant={variant} />
))}
</div>
</div>
);
};
@@ -0,0 +1,109 @@
// shared/Components/SkeletonGallery/SkeletonGallery.module.scss
.skeletonGallery {
margin: 0 10%;
text-align: left;
display: block;
@media (max-width: $mobile-xs-width) {
margin: 0 5%;
}
}
.title {
height: 44px;
width: 25%;
background-color: #e0e0e0;
border-radius: 4px;
margin-bottom: 16px;
position: relative;
overflow: hidden;
@media (max-width: $tablet-max-width) {
height: 32px;
}
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
.images {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 32px;
@media (max-width: $tablet-max-width) {
grid-template-columns: repeat(2, 1fr);
}
@media (max-width: $mobile-xs-width) {
grid-template-columns: 1fr;
}
}
.imageContainer {
height: 352px;
background-color: #e0e0e0;
border-radius: 8px;
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
.wide {
grid-column: span 4;
}
.narrow {
grid-column: span 2;
}
@keyframes shimmer {
0% {
left: -150%;
}
100% {
left: 150%;
}
}
@media (max-width: $tablet-max-width) {
.wide,
.narrow {
grid-column: span 1;
}
}
@media (max-width: $mobile-xs-width) {
.wide,
.narrow {
grid-column: span 1;
}
}
@@ -0,0 +1,21 @@
import styles from "./SkeletonGallery.module.scss";
export const SkeletonGallery = () => {
return (
<div className={styles.skeletonGallery}>
<div className={styles.title}></div>
<div className={styles.images}>
<div className={`${styles.imageContainer} ${styles.wide}`}></div>
<div className={`${styles.imageContainer} ${styles.narrow}`}></div>
<div className={`${styles.imageContainer} ${styles.narrow}`}></div>
<div className={`${styles.imageContainer} ${styles.narrow}`}></div>
<div className={`${styles.imageContainer} ${styles.narrow}`}></div>
<div className={`${styles.imageContainer} ${styles.narrow}`}></div>
<div className={`${styles.imageContainer} ${styles.wide}`}></div>
</div>
</div>
);
};
@@ -0,0 +1,51 @@
.card {
position: relative;
width: 100%;
height: 250px;
border-radius: 8px;
background-color: #e0e0e0;
overflow: hidden;
@media (max-width: 768px) {
height: 215px !important;
}
}
.pic {
width: 100%;
height: 100%;
border-radius: 8px;
background-color: #ddd;
position: relative;
}
.shimmer {
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%);
animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
0% {
left: -150%;
}
100% {
left: 150%;
}
}
.labsCard {
height: 300px;
@media (max-width: 768px) {
height: 215px !important;
}
}
@@ -0,0 +1,23 @@
// shared/Components/SkeletonCard/SkeletonCard.tsx
import styles from "./SkeletonCard.module.scss";
interface SkeletonCardProps {
variant?: "default" | "lab";
}
const SkeletonCard = ({ variant = "default" }: SkeletonCardProps) => {
const cardClass =
variant === "lab"
? `${styles.card} ${styles.labsCard}`
: styles.card;
return (
<div className={cardClass}>
<div className={styles.pic}>
<div className={styles.shimmer}></div>
</div>
</div>
);
};
export default SkeletonCard;
@@ -0,0 +1,15 @@
.skeletonGrid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
width: 100%;
margin: 0 10%;
@media (max-width: 768px) {
grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 769px) and (max-width: 1024px) {
grid-template-columns: repeat(2, 1fr);
}
}
@@ -0,0 +1,33 @@
// shared/ui/SkeletonGrid/SkeletonGrid.tsx
import React from "react";
import SkeletonCard from "./SkeletonCard";
import styles from "@/shared/styles/cardGrid.module.scss";
interface SkeletonGridProps {
count?: number;
gridConfig?: { desktop: number; tablet: number; mobile: number };
variant?: "default" | "lab";
}
export const SkeletonGrid = ({
count = 3,
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
variant = "default",
}: SkeletonGridProps) => {
return (
<div className={styles.mainContainer}>
<div
className={styles.gridСontainer}
style={{
"--desktop-columns": gridConfig.desktop,
"--tablet-columns": gridConfig.tablet,
"--mobile-columns": gridConfig.mobile,
} as React.CSSProperties}
>
{[...Array(count)].map((_, index) => (
<SkeletonCard key={index} variant={variant} />
))}
</div>
</div>
);
};
@@ -0,0 +1,101 @@
.skeletonPost {
padding-top: 10px;
padding-bottom: 20px;
display: flex;
flex-direction: column;
width: 100%;
gap: 16px;
}
.topLine {
height: 32px;
width: 300px;
background-color: #e0e0e0;
border-radius: 4px;
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
.textLine {
height: 32px;
background-color: #e0e0e0;
border-radius: 4px;
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
.splitLine {
display: flex;
justify-content: space-between;
gap: 16px;
background: none;
overflow: visible;
> div {
height: 32px;
border-radius: 4px;
background-color: #e0e0e0;
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
}
.thirty { width: 30%; }
.seventy { width: 70%; }
@keyframes shimmer {
0% {
left: -150%;
}
100% {
left: 150%;
}
}
@@ -0,0 +1,22 @@
import styles from "./SkeletonPost.module.scss";
export const SkeletonPost = () => {
return (
<div className={styles.skeletonPost}>
<div className={styles.topLine}></div>
<div className={styles.textLine}></div>
<div className={styles.splitLine}>
<div className={styles.seventy}></div>
<div className={styles.thirty}></div>
</div>
<div className={styles.textLine}></div>
<div className={styles.splitLine}>
<div className={styles.thirty}></div>
<div className={styles.seventy}></div>
</div>
<div className={styles.textLine}></div>
</div>
);
};
@@ -0,0 +1,60 @@
.sliderSkeleton {
width: 100%;
margin: 0 auto;
position: relative;
padding: 10px 0;
}
.slideContainer {
display: flex;
gap: 20px;
@media (max-width: 768px) {
flex-direction: column;
gap: 15px;
}
}
.slide {
flex: 1;
position: relative;
overflow: hidden;
border-radius: 8px;
}
.image {
width: 100%;
height: 350px;
background-color: #e0e0e0;
position: relative;
overflow: hidden;
@media (max-width: 768px) {
height: 250px;
}
&::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 1.5s infinite;
}
}
@keyframes shimmer {
0% {
left: -150%;
}
100% {
left: 150%;
}
}
@@ -0,0 +1,15 @@
import styles from "./SkeletonSlider.module.scss";
export const SkeletonSlider = () => {
return (
<div className={styles.sliderSkeleton}>
<div className={styles.slideContainer}>
{[...Array(2)].map((_, index) => (
<div key={index} className={styles.slide}>
<div className={styles.image}></div>
</div>
))}
</div>
</div>
);
};
@@ -0,0 +1,41 @@
// shared/lib/withLoading/withLoading.tsx
import React from "react";
import { SkeletonGrid } from "../SkeletonGrid/SkeletonGrid";
import styles from "../Skeleton/SkeletonCard.module.scss";
interface WithLoadingProps {
isLoading: boolean;
isError: boolean;
count?: number;
gridConfig?: { desktop: number; tablet: number; mobile: number };
variant?: "default" | "lab";
children: React.ReactNode;
}
export const WithLoading = ({
isLoading,
isError,
count = 3,
gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
variant = "default",
children,
}: WithLoadingProps) => {
if (isLoading) {
return (
<div>
<div className={styles.titleSkeleton}></div>
<SkeletonGrid
count={count}
gridConfig={gridConfig}
variant={variant}
/>
</div>
);
}
if (isError) {
return <center>Ошибка при загрузке данных</center>;
}
return <>{children}</>;
};
+16 -3
View File
@@ -2,7 +2,8 @@ import Parse from "html-react-parser";
export type ParsedContent =
| { type: "html"; element: any } // Сохраняем исходные HTML-элементы
| { type: "mediablock"; value: string[] }; // Группируем медиа-элементы
| { type: "mediablock"; value: string[] } // Группируем медиа-элементы
| { type: "slider"; value: string[] }; // Группируем картинки под слайдер
export const parseContent = (html: string): ParsedContent[] => {
const elements = Parse(html);
@@ -19,20 +20,32 @@ export const parseContent = (html: string): ParsedContent[] => {
}
// Обработка медиа-элементов (img внутри figure)
if (node.type === "figure") {
if (node.type === "figure" && node.props.className.includes('wp-block-image')) {
const imgSrc = node.props.children?.props?.src;
if (imgSrc) {
mediaBuffer.push(imgSrc);
}
return; // Пропускаем добавление figure в результат
}
// Если есть накопленные медиа-элементы, добавляем их как mediablock
if (mediaBuffer.length > 0) {
result.push({ type: "mediablock", value: [...mediaBuffer] });
mediaBuffer = [];
}
if (node.props.className?.includes('wp-block-gallery')) {
const slider = [];
for (const child of node.props.children) {
const imgSrc = child.props?.children.props?.src;
if (imgSrc) {
slider.push(imgSrc);
}
}
result.push({ type: "slider", value: slider });
return;
}
// Сохраняем текущий элемент как есть
result.push({ type: "html", element: node });
};
@@ -0,0 +1,41 @@
import { useEffect } from 'react';
type ResizeHandler = (parent: HTMLElement, childHeight: number) => void;
interface UseResizeObserverConfig {
parentSelector: string;
childSelector?: string;
onResize?: ResizeHandler;
}
export const useResizeObserver = ({
parentSelector,
childSelector = 'blockquote',
onResize = (parent, height) => {
parent.style.paddingBottom = `calc(${height}px + 2em)`;
}
}: UseResizeObserverConfig) => {
useEffect(() => {
const resizeObserver = new ResizeObserver(entries => {
entries.forEach(entry => {
const parent = entry.target as HTMLElement;
const child = parent.querySelector(childSelector) as HTMLElement | null;
if (child) {
const childHeight = child.offsetHeight;
onResize(parent, childHeight);
}
});
});
const elements = document.querySelectorAll(parentSelector);
const elementsArray = Array.from(elements) as HTMLElement[];
elementsArray.forEach(element => resizeObserver.observe(element));
return () => {
elementsArray.forEach(element => resizeObserver.unobserve(element));
resizeObserver.disconnect();
};
}, [parentSelector, childSelector, onResize]);
};
+52
View File
@@ -0,0 +1,52 @@
// shared/styles/cardGrid.module.scss
:export {
--desktop-columns: 3;
--tablet-columns: 2;
--mobile-columns: 1;
}
.mainContainer {
margin: 0 10%;
@include mediaMax($mobile-xs-width) {
margin: 0 5%;
}
}
.gridСontainer {
display: grid;
gap: 2rem;
margin: 0 auto;
width: 100%;
max-width: 100%;
box-sizing: border-box;
grid-template-columns: repeat(3, 1fr);
@media (max-width: 1024px) {
grid-template-columns: repeat(var(--tablet-columns), 1fr);
}
@media (max-width: 768px) {
grid-template-columns: repeat(var(--mobile-columns), 1fr);
}
}
.cardSizes {
&--lab {
height: 300px;
@media (max-width: 768px) {
height: 215px;
}
}
&--news,
&--project {
height: 250px;
@media (max-width: 768px) {
height: 215px;
}
}
}
+1 -1
View File
@@ -291,7 +291,7 @@ declare namespace App {
value: string[];
}
export type ParsedContent = HtmlElement | MediaBlock;
export type ParsedContent = HtmlElement | MediaBlock | Slider;
export interface WpPost {
id: number;
+4 -7
View File
@@ -1,17 +1,14 @@
.mainContainer {
margin: 0 10%;
@include mediaMax($mobile-xs-width) {
margin: 0 5%;
}
}
@import "@/shared/styles/cardGrid.module.scss";
.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;
}
}
}
+47 -57
View File
@@ -1,5 +1,6 @@
// pages/MainPage/ui/MainPage/Lists.tsx
import { CardListTemplate } from "@/widgets/CardList/CardListTemplate";
import { WithLoading } from "@/shared/Components/WithLoading/WithLoading";
import { GridConfig } from "@/widgets/CardList/types";
import { usePosts } from "@/modules/posts/hooks/usePosts";
import styles from "./CardList.module.scss";
@@ -20,27 +21,24 @@ const NewsList = ({
}: ListProps) => {
const { data: newsData, isLoading, isError } = useNews();
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 && (
<CardListTemplate
items={transformNewsToCardData(newsData)}
variant="news"
gridConfig={gridConfig}
title="Новости"
/>
)}
</div>
<WithLoading
isLoading={isLoading}
isError={isError}
count={4}
gridConfig={gridConfig}
>
<div className={styles.mainContainer}>
{newsData && (
<CardListTemplate
items={transformNewsToCardData(newsData)}
variant="news"
gridConfig={gridConfig}
title="Новости"
/>
)}
</div>
</WithLoading>
);
};
@@ -50,25 +48,21 @@ const LabsList = ({
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}>
<CardListTemplate
items={transformPostsToCardData(labs)}
variant="lab"
gridConfig={gridConfig}
title="Наши лаборатории"
/>
</div>
<WithLoading
isLoading={isLoading}
isError={isError}
gridConfig={gridConfig}
>
<div className={styles.mainContainer}>
<CardListTemplate
items={transformPostsToCardData(labs)}
variant="lab"
gridConfig={gridConfig}
title="Наши лаборатории"
/>
</div>
</WithLoading>
);
};
@@ -79,26 +73,22 @@ const ProjectsList = ({
const { data, isError, isLoading } = usePostProjects(tag);
const projects = data ?? [];
if (isLoading)
return (
<div className="mainContainer">
<h2 className={styles.title}>Наши проекты</h2>
<span className="loader"></span>
</div>
);
if (isError || !projects) return <div>Ошибка при загрузке данных</div>;
return (
<div className={styles.mainContainer}>
<CardListTemplate
//@ts-ignore
items={transformPostsToCardData(projects)}
variant="project"
gridConfig={gridConfig}
title="Наши проекты"
/>
</div>
<WithLoading
isLoading={isLoading}
isError={isError}
gridConfig={gridConfig}
>
<div className={styles.mainContainer}>
<CardListTemplate
//@ts-ignore
items={transformPostsToCardData(projects)}
variant="project"
gridConfig={gridConfig}
title="Наши проекты"
/>
</div>
</WithLoading>
);
};
@@ -1,36 +1,40 @@
@import "@/shared/styles/cardGrid.module.scss";
.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;
@extend .gridСontainer;
&__lab {
grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
grid-template-columns: repeat(var(--desktop-columns), 1fr);
@include mediaMax($desktop-small-width) {
grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
grid-template-columns: repeat(var(--tablet-columns), 1fr);
}
@include mediaMax($tablet-max-width) {
grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
grid-template-columns: repeat(var(--mobile-columns), 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);
}
@@ -38,11 +42,13 @@
&__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);
}
}
}
}
+5 -2
View File
@@ -1,5 +1,6 @@
import { usePosts } from "@/modules/posts/hooks/usePosts";
import { WpPost } from "@/widgets/WpPost";
import {SkeletonPost} from "@/shared/Components/SkeletonPost/SkeletonPost";
interface CategoryPageProps {
category: string;
@@ -15,10 +16,12 @@ export function CategoryPage({ category }: CategoryPageProps) {
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
{[...Array(1)].map((_, index) => (
<SkeletonPost key={index} />
))}
</div>
);
if (isError) return <div>Ошибка при загрузке данных</div>;
if (isError) return <center>Ошибка при загрузке данных</center>;
return (
<>
+45 -17
View File
@@ -1,4 +1,3 @@
#footer {
display: flex;
justify-content: space-between;
@@ -80,9 +79,11 @@
gap: 32px;
justify-content: center;
}
.copyright {
display: none;
}
.visible {
display: block;
}
@@ -100,6 +101,7 @@
.visible {
display: none !important;
}
.copyright {
display: block !important; // Показываем текст внизу только в мобильной версии
text-align: center;
@@ -122,6 +124,7 @@
display: flex;
justify-content: center;
gap: 20px;
.logo {
height: auto;
width: 100%;
@@ -163,37 +166,62 @@
}
}
}
.footer-links-container {
display: flex;
flex-direction: column; /* Arrange links vertically */
justify-content: space-between; /* Spread out the items */
height: 100%; /* Make sure the container takes up full height */
flex-direction: column;
/* Arrange links vertically */
justify-content: space-between;
/* Spread out the items */
height: 100%;
/* Make sure the container takes up full height */
}
.footer-links {
display: flex;
justify-content: space-between;
gap: 30px; // Между столбиками будет отступ
gap: 30px;
.footer-column {
display: flex;
flex-direction: column;
gap: 20px; // Расстояние между ссылками в одном столбике
gap: 20px;
a {
color: white; // Белый цвет текста
text-decoration: none; // Убираем подчеркивание
font-size: 16px; // Размер текста
color: white;
text-decoration: none;
font-size: 16px;
position: relative;
display: inline-block;
width: fit-content;
&::after {
content: '';
position: absolute;
left: 50%;
bottom: -5px;
width: 0;
height: 1px;
background-color: white;
transition: width 0.3s ease, left 0.3s ease;
transform: translateX(-50%);
}
&:hover::after {
width: 100%;
left: 50%;
}
}
}
}
.privacy-policy {
align-self: flex-end; /* Align the "Политика конфиденциальности" link to the bottom */
margin-top: auto; /* Ensure the link is pushed to the bottom */
}
.privacy-policy {
align-self: flex-end;
/* Align the "Политика конфиденциальности" link to the bottom */
margin-top: auto;
/* Ensure the link is pushed to the bottom */
}
}
#root:has(#mainpageheader) #footer {
+1 -1
View File
@@ -1,5 +1,5 @@
#numbers {
margin-bottom: 48px;
margin-bottom: 24px;
img {
pointer-events: none;
+1 -1
View File
@@ -10,7 +10,7 @@ $logo-size: 200px;
justify-content: space-between;
align-items: center;
h1 {
font-family: Montserrat;
font-family: 'Montserrat', sans-serif;
font-size: 36px;
font-weight: 600;
margin-bottom: 1.5rem;
@@ -13,7 +13,7 @@
font-weight: 600;
line-height: 44px;
margin-top: 0;
margin-bottom: 8px;
margin-bottom: 16px;
@include mediaMax($tablet-max-width) {
font-size: 24px;
+11 -9
View File
@@ -1,5 +1,6 @@
import { useState } from "react";
import { useMedia } from "@/modules/media/hooks/useMedia";
import { SkeletonGallery } from "@/shared/Components/SkeletonGallery/SkeletonGallery";
import "./PhotoGallery.style.scss"
@@ -14,16 +15,19 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
const filteredMedia = images
? images.map((src, id) => ({ id, src }))
: mediaData || []; // без фильтра
: mediaData || [];
if (isLoading)
if (isLoading) {
return (
<div className="mainContainer">
<span className="loader"></span>
<div>
<SkeletonGallery />
</div>
);
}
if (isError) return <div>Ошибка при загрузке медиа</div>;
if (isError || !filteredMedia || filteredMedia.length === 0) {
return <center>Ошибка при загрузке медиа</center>;
}
return (
<div className="mainContainer">
@@ -39,12 +43,10 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
</div>
))}
</div>
<div className="btn">
Загрузить ещё
</div>
<div className="btn">Загрузить ещё</div>
</div>
);
};
export default PhotoGallery;
+46 -41
View File
@@ -10,14 +10,16 @@ import "swiper/css/pagination";
import "./Slider.styles.scss";
import { MediaItem } from "@/modules/media/api/get";
import { SkeletonSlider } from "@/shared/Components/SkeletonSlider/SkeletonSlider";
interface SliderProps {
autoPlay?: boolean;
autoPlayTime?: number;
images?: string[];
category?: string;
customPerSlide: number;
}
// Update the SliderContextType interface to include the missing properties
interface SliderContextType {
slideNumber: number;
mediaList: MediaItem[];
@@ -26,13 +28,10 @@ interface SliderContextType {
slidesCount: number; // Added for Dots component
}
// Then in your Slider component, update the context value:
// Create context with default values
export const SliderContext = createContext<SliderContextType>({
slideNumber: 0,
mediaList: [],
goToSlide: () => {},
goToSlide: () => { },
slidesCount: 0,
});
@@ -41,9 +40,11 @@ function Slider({
autoPlayTime = 3000,
images,
category = "gallery",
customPerSlide = 0
}: SliderProps) {
const { data: mediaData, isLoading, isError } = useMedia();
const [itemsPerSlide, setItemsPerSlide] = useState<number>(
customPerSlide !== 0 ? 4 :
window.innerWidth <= 768 ? 1 : 2
);
const [enableButtons, setEnableButtons] = useState<boolean>(false);
@@ -64,7 +65,7 @@ function Slider({
useEffect(() => {
const numberOfSlides = filteredMedia.length;
if (numberOfSlides > 2) {
if (numberOfSlides > 2 || customPerSlide !== 0) {
setEnableButtons(true);
} else if (numberOfSlides === 1) {
setItemsPerSlide(1);
@@ -73,11 +74,13 @@ function Slider({
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
<div >
{[...Array(1)].map((_, index) => (
<SkeletonSlider key={index} />
))}
</div>
);
if (isError) return <div>Ошибка при загрузке медиа</div>;
if (isError) return <center>Ошибка при загрузке медиа</center>;
// Create context value
const contextValue: SliderContextType = {
@@ -91,38 +94,40 @@ function Slider({
return (
<SliderContext.Provider value={contextValue}>
<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
}
onSlideChange={(swiper) => setSlideNumber(swiper.activeIndex)}
>
{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 className="full-width-container">
<Swiper
modules={[Navigation, Pagination]}
spaceBetween={20}
slidesPerView={itemsPerSlide}
slidesPerGroup={1}
loop={enableButtons}
navigation={enableButtons}
pagination={{ clickable: enableButtons }}
autoplay={
autoPlay
? { delay: autoPlayTime, disableOnInteraction: false }
: false
}
onSlideChange={(swiper) => setSlideNumber(swiper.activeIndex)}
>
{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>
</div>
</SliderContext.Provider>
);
+3 -4
View File
@@ -64,11 +64,10 @@ $btn-primary-bg: linear-gradient(
text-align: left;
font-size: 18px;
color: #000;
font-family: "Montserrat";
font-family: 'Montserrat', sans-serif;
font-style: normal;
font-display: swap;
src: url("../fonts/Montserrat/Montserrat-VariableFont_wght.ttf") format("truetype");
}
}
.bold {
font-size: 22px;
@@ -100,5 +99,5 @@ $btn-primary-bg: linear-gradient(
font-size: 20px;
font-weight: 600;
text-align: center;
font-family: "Montserrat";
font-family: 'Montserrat', sans-serif;
}
+192
View File
@@ -0,0 +1,192 @@
$color-highlight: #072AC8;
$table-header-color: #EEEEEE;
$table-body-bg: #ffffff;
$color-usual: #ACACAC;
$border-raduis: 16px;
$background-tape: #F5F5F7;
$slider: 476px;
$swiper-button-size: 48px;
$swiper-button-arrow-size: 20px;
: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%;
}
.project {
.header {
text-align: center;
margin-bottom: 2em;
}
.wp-block-columns {
margin-bottom: 2em;
}
.is-layout-flex {
display: flex;
justify-content: space-between;
gap: 2em;
figure {
img {
max-width: 100%;
height: auto;
object-fit: contain !important; // Wordpress накидывает styles к элементу, приходится перебивать
}
}
}
.has-text-align-center {
text-align: center;
}
.has-text-align-justify {
text-align: justify;
}
.is-style-rounded * {
border-radius: 16px;
}
// "Цитаты"
.wp-block-pullquote {
* {
margin-bottom: 0;
}
blockquote {
display: flex;
justify-content: center;
position: absolute;
left: 0;
width: 100%;
padding: 16px 0;
background: $background-tape;
p {
display: inline-block;
max-width: 40%;
text-align: center;
}
}
}
// Таблица
.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: 18px;
word-wrap: normal;
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%);
}
}
}
}
.slider {
position: static;
height: $slider;
.full-width-container {
position: absolute;
left: 0;
width: 100%;
}
.swiper {
padding-top: 4em;
.swiper-wrapper .swiper-slide .slide-image {
border-radius: 0;
}
.swiper-button-prev,
.swiper-button-next {
top: calc($swiper-button-size / 2);
left: auto;
width: $swiper-button-size;
height: $swiper-button-size;
color: black;
border: 2px solid black;
border-radius: 100%;
}
.swiper-button-prev::after,
.swiper-button-next::after {
font-size: $swiper-button-arrow-size;
}
.swiper-button-prev {
right: calc(10% + 24px + $swiper-button-size);
}
.swiper-button-next {
right: 10%;
}
.swiper-pagination {
display: none;
}
}
}
}
+11 -3
View File
@@ -1,10 +1,13 @@
import { ReactNode } from "react";
import MediaBlock from "@/widgets/MediaBlock/MediaBlock";
import { PageContent, PageHeader } from "@/widgets/WpPost";
import { useResizeObserver } from "@/shared/lib/ResizeObserver/ResizeObserver";
import { App } from "@/shared/types/app";
import "./Projects.scss";
import Slider from "../Slider/Slider";
interface WpPostProps {
post: App.WpPostPage;
children?: ReactNode;
@@ -14,8 +17,11 @@ export default function WpPost({
post,
children,
}: WpPostProps) {
useResizeObserver({parentSelector: '.wp-block-pullquote'});
// useResizeObserver({parentSelector: ".swiper", childSelector: ".swiper-wrapper"});
return (
<>
<div className={post.categories?.includes('projects') ? "project" : ""}>
<PageHeader className="header">
<h1>{post.title}</h1>
</PageHeader>
@@ -24,11 +30,13 @@ export default function WpPost({
post.content.map((el, index) => {
if (el.type === "mediablock") {
return <MediaBlock key={index} images={el.value} />;
} else if (el.type === "slider") {
return <Slider images={el.value} customPerSlide={4} />
}
return <div key={index}>{el.element}</div>;
})}
{children}
</PageContent>
</>
</div>
);
}