diff --git a/src/pages/NewsItem/NewsItem.styles.scss b/src/pages/NewsItem/NewsItem.styles.scss index d26b265..6e6075c 100644 --- a/src/pages/NewsItem/NewsItem.styles.scss +++ b/src/pages/NewsItem/NewsItem.styles.scss @@ -3,7 +3,7 @@ justify-content: space-between; margin-top: 2em; - > * { + >* { display: inline-block; width: fit-content; } @@ -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; + } + } + } +} diff --git a/src/pages/NewsItem/NewsItem.tsx b/src/pages/NewsItem/NewsItem.tsx index 674fe96..544dbf9 100644 --- a/src/pages/NewsItem/NewsItem.tsx +++ b/src/pages/NewsItem/NewsItem.tsx @@ -10,6 +10,18 @@ import { useNewsById } from "@/modules/news/hooks/useNewsById"; import { PageContent, PageHeader } from "@/widgets/WpPost"; import Slider from "@/widgets/Slider/Slider"; 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() { const params = useParams(); @@ -28,6 +40,7 @@ function NewsItem() { if (isLoading) return (