изменила ковычки и загрузка стр с начала стр

This commit is contained in:
xomimishka committed 2025-07-11 11:30:26 +03:00
1 parent af5ffa0ba0
commit e54e2f1ae9
2 files changed
+54 -7

No files matched your search

+27
View File
@@ -29,3 +29,30 @@
} }
} }
} }
#news-item-page {
.single-image-container {
height: 600px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20px;
img {
max-height: 100%;
width: auto;
max-width: 100%;
object-fit: contain;
pointer-events: none;
}
@media (max-width: 768px) {
height: auto;
img {
width: 100%;
height: auto;
object-fit: contain;
}
}
}
}
+27 -7
View File
@@ -10,6 +10,18 @@ import { useNewsById } from "@/modules/news/hooks/useNewsById";
import { PageContent, PageHeader } from "@/widgets/WpPost"; import { PageContent, PageHeader } from "@/widgets/WpPost";
import Slider from "@/widgets/Slider/Slider"; import Slider from "@/widgets/Slider/Slider";
export const vkWallUrl = "https://vk.com/skbkit?w=wall-172789021"; export const vkWallUrl = "https://vk.com/skbkit?w=wall-172789021";
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
export const ScrollToTop = () => {
const { pathname } = useLocation();
useEffect(() => {
window.scrollTo({ top: 0, left: 0, behavior: "instant" });
}, [pathname]);
return null;
};
function NewsItem() { function NewsItem() {
const params = useParams(); const params = useParams();
@@ -28,6 +40,7 @@ function NewsItem() {
if (isLoading) if (isLoading)
return ( return (
<div className="mainContainer"> <div className="mainContainer">
<ScrollToTop />
{[...Array(1)].map((_, index) => ( {[...Array(1)].map((_, index) => (
<SkeletonPost key={index} /> <SkeletonPost key={index} />
))} ))}
@@ -38,8 +51,8 @@ function NewsItem() {
<> <>
<Helmet> <Helmet>
<title> <title>
Ошибка загрузки новости | СКБ "Компьютерное инновационное Ошибка загрузки новости | СКБ «Компьютерное инновационное
творчество" творчество»
</title> </title>
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
</Helmet> </Helmet>
@@ -55,8 +68,8 @@ function NewsItem() {
<> <>
<Helmet> <Helmet>
<title> <title>
{news.heading || "Новость"} | СКБ "Компьютерное инновационное {news.heading || "Новость"} | СКБ «Компьютерное инновационное
творчество" творчество»
</title> </title>
<meta <meta
name="description" name="description"
@@ -67,8 +80,7 @@ function NewsItem() {
/> />
<meta <meta
name="keywords" name="keywords"
content={`СКБ, новости, ${ content={`СКБ, новости, ${news.heading || ""
news.heading || ""
}, ИКТИБ, ЮФУ, студенческие проекты, инновации`} }, ИКТИБ, ЮФУ, студенческие проекты, инновации`}
/> />
<meta name="robots" content="index,follow" /> <meta name="robots" content="index,follow" />
@@ -77,7 +89,15 @@ function NewsItem() {
<h1>{news.heading}</h1> <h1>{news.heading}</h1>
</PageHeader> </PageHeader>
<PageContent className="content" id="news-item-page"> <PageContent className="content" id="news-item-page">
{news.photos.length !== 0 && <Slider images={news.photos} category="news"/>} {news.photos.length !== 0 &&
(news.photos.length === 1 ? (
<div className="single-image-container">
<img src={news.photos[0]} alt={news.heading} />
</div>
) : (
<Slider images={news.photos} category="news" />
))
}
{news.text.map((textRow, index) => ( {news.text.map((textRow, index) => (
<p key={index} dangerouslySetInnerHTML={{ __html: textRow }} /> <p key={index} dangerouslySetInnerHTML={{ __html: textRow }} />
))} ))}