diff --git a/src/pages/NewsItem/NewsItem.tsx b/src/pages/NewsItem/NewsItem.tsx index 71eeb3d..4c9818d 100644 --- a/src/pages/NewsItem/NewsItem.tsx +++ b/src/pages/NewsItem/NewsItem.tsx @@ -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 (
- + {[...Array(1)].map((_, index) => ( + + ))}
); - if (isError) return
Ошибка при загрузке новости
; + if (isError) return
Ошибка при загрузке новости
; const newsUrl = `${vkWallUrl}_${newsID}`; diff --git a/src/pages/WpPostPage/WpPostPage.tsx b/src/pages/WpPostPage/WpPostPage.tsx index 6c3161e..9206adb 100644 --- a/src/pages/WpPostPage/WpPostPage.tsx +++ b/src/pages/WpPostPage/WpPostPage.tsx @@ -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 (
- + {[...Array(1)].map((_, index) => ( + + ))}
); } if (isError) { - return
Ошибка при загрузке данных
; + return
Ошибка при загрузке данных
; } console.log('post', post); return (<> diff --git a/src/shared/Components/Skeleton/SkeletonCard.module.scss b/src/shared/Components/Skeleton/SkeletonCard.module.scss index e894101..306a9a5 100644 --- a/src/shared/Components/Skeleton/SkeletonCard.module.scss +++ b/src/shared/Components/Skeleton/SkeletonCard.module.scss @@ -57,7 +57,7 @@ margin: 0 5%; } height: 40px; - width: 25.5%; + width: 25.3%; border-radius: 4px; background-color: #e0e0e0; position: relative; @@ -67,6 +67,7 @@ @media (max-width: 768px) { height: 32px; width: 70%; + margin-bottom: 16px; } } diff --git a/src/shared/Components/Skeleton/SkeletonGrid.tsx b/src/shared/Components/Skeleton/SkeletonGrid.tsx index aa4da02..cc6a5d6 100644 --- a/src/shared/Components/Skeleton/SkeletonGrid.tsx +++ b/src/shared/Components/Skeleton/SkeletonGrid.tsx @@ -1,4 +1,3 @@ -// shared/ui/SkeletonGrid/SkeletonGrid.tsx import React from "react"; import SkeletonCard from "./SkeletonCard"; import styles from "@/shared/styles/cardGrid.module.scss"; diff --git a/src/shared/Components/SkeletonGallery/SkeletonGallery.module.scss b/src/shared/Components/SkeletonGallery/SkeletonGallery.module.scss new file mode 100644 index 0000000..90d1d2b --- /dev/null +++ b/src/shared/Components/SkeletonGallery/SkeletonGallery.module.scss @@ -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; + } + } \ No newline at end of file diff --git a/src/shared/Components/SkeletonGallery/SkeletonGallery.tsx b/src/shared/Components/SkeletonGallery/SkeletonGallery.tsx new file mode 100644 index 0000000..4798ad4 --- /dev/null +++ b/src/shared/Components/SkeletonGallery/SkeletonGallery.tsx @@ -0,0 +1,21 @@ +import styles from "./SkeletonGallery.module.scss"; + +export const SkeletonGallery = () => { + return ( +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/shared/Components/SkeletonPost/SkeletonPost.module.scss b/src/shared/Components/SkeletonPost/SkeletonPost.module.scss new file mode 100644 index 0000000..324ba63 --- /dev/null +++ b/src/shared/Components/SkeletonPost/SkeletonPost.module.scss @@ -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%; + } +} \ No newline at end of file diff --git a/src/shared/Components/SkeletonPost/SkeletonPost.tsx b/src/shared/Components/SkeletonPost/SkeletonPost.tsx new file mode 100644 index 0000000..5ff5c33 --- /dev/null +++ b/src/shared/Components/SkeletonPost/SkeletonPost.tsx @@ -0,0 +1,22 @@ +import styles from "./SkeletonPost.module.scss"; + +export const SkeletonPost = () => { + return ( +
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/shared/Components/SkeletonSlider/SkeletonSlider.module.scss b/src/shared/Components/SkeletonSlider/SkeletonSlider.module.scss new file mode 100644 index 0000000..a800c56 --- /dev/null +++ b/src/shared/Components/SkeletonSlider/SkeletonSlider.module.scss @@ -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%; + } +} \ No newline at end of file diff --git a/src/shared/Components/SkeletonSlider/SkeletonSlider.tsx b/src/shared/Components/SkeletonSlider/SkeletonSlider.tsx new file mode 100644 index 0000000..ed291ed --- /dev/null +++ b/src/shared/Components/SkeletonSlider/SkeletonSlider.tsx @@ -0,0 +1,15 @@ +import styles from "./SkeletonSlider.module.scss"; + +export const SkeletonSlider = () => { + return ( +
+
+ {[...Array(2)].map((_, index) => ( +
+
+
+ ))} +
+
+ ); +}; \ No newline at end of file diff --git a/src/shared/Components/WithLoading/WithLoading.tsx b/src/shared/Components/WithLoading/WithLoading.tsx index 866a7d0..9955f75 100644 --- a/src/shared/Components/WithLoading/WithLoading.tsx +++ b/src/shared/Components/WithLoading/WithLoading.tsx @@ -34,7 +34,7 @@ export const WithLoading = ({ } if (isError) { - return
Ошибка при загрузке данных
; + return
Ошибка при загрузке данных
; } return <>{children}; diff --git a/src/widgets/CategoryPage/CategoryPage.tsx b/src/widgets/CategoryPage/CategoryPage.tsx index d1a0046..0b78673 100644 --- a/src/widgets/CategoryPage/CategoryPage.tsx +++ b/src/widgets/CategoryPage/CategoryPage.tsx @@ -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 (
- + {[...Array(1)].map((_, index) => ( + + ))}
); - if (isError) return
Ошибка при загрузке данных
; + if (isError) return
Ошибка при загрузке данных
; return ( <> diff --git a/src/widgets/Footer/Footer.styles.scss b/src/widgets/Footer/Footer.styles.scss index c6ce441..1b2d53a 100644 --- a/src/widgets/Footer/Footer.styles.scss +++ b/src/widgets/Footer/Footer.styles.scss @@ -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; // Между столбиками будет отступ - + .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; + + &::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: calc(100% + 8px); + left: 50%; + transform: translateX(-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 { diff --git a/src/widgets/PhotoGallery/PhotoGallery.style.scss b/src/widgets/PhotoGallery/PhotoGallery.style.scss index 215b772..06afdb3 100644 --- a/src/widgets/PhotoGallery/PhotoGallery.style.scss +++ b/src/widgets/PhotoGallery/PhotoGallery.style.scss @@ -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; diff --git a/src/widgets/PhotoGallery/PhotoGallery.tsx b/src/widgets/PhotoGallery/PhotoGallery.tsx index 810ca2e..7535fb3 100644 --- a/src/widgets/PhotoGallery/PhotoGallery.tsx +++ b/src/widgets/PhotoGallery/PhotoGallery.tsx @@ -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 ( -
- +
+
); + } - if (isError) return
Ошибка при загрузке медиа
; + if (isError || !filteredMedia || filteredMedia.length === 0) { + return
Ошибка при загрузке медиа
; + } return (
@@ -39,12 +43,10 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
))}
- -
- Загрузить ещё -
+
Загрузить ещё
); }; + export default PhotoGallery; diff --git a/src/widgets/Slider/Slider.tsx b/src/widgets/Slider/Slider.tsx index 9c54682..769ca00 100644 --- a/src/widgets/Slider/Slider.tsx +++ b/src/widgets/Slider/Slider.tsx @@ -10,6 +10,8 @@ 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; @@ -32,7 +34,7 @@ interface SliderContextType { export const SliderContext = createContext({ slideNumber: 0, mediaList: [], - goToSlide: () => {}, + goToSlide: () => { }, slidesCount: 0, }); @@ -73,11 +75,13 @@ function Slider({ if (isLoading) return ( -
- +
+ {[...Array(1)].map((_, index) => ( + + ))}
); - if (isError) return
Ошибка при загрузке медиа
; + if (isError) return
Ошибка при загрузке медиа
; // Create context value const contextValue: SliderContextType = {