diff --git a/src/pages/MainPage/ui/MainPage/MainPage.module.scss b/src/pages/MainPage/ui/MainPage/MainPage.module.scss index 174d903..a773c56 100644 --- a/src/pages/MainPage/ui/MainPage/MainPage.module.scss +++ b/src/pages/MainPage/ui/MainPage/MainPage.module.scss @@ -19,7 +19,7 @@ body { margin: 0; margin-bottom: 20px; color: $text-secondary; - background-image: url("/src/shared/assets/images/art.bmp"); + //background-image: url("/src/shared/assets/images/art.bmp"); background-color: $bg-image; background-blend-mode: multiply; background-position: center; diff --git a/src/pages/MainPage/ui/MainPage/MainPage.tsx b/src/pages/MainPage/ui/MainPage/MainPage.tsx index 09eef6c..afe97d4 100644 --- a/src/pages/MainPage/ui/MainPage/MainPage.tsx +++ b/src/pages/MainPage/ui/MainPage/MainPage.tsx @@ -1,6 +1,6 @@ +import { useContext, useEffect, useState } from "react"; 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"; @@ -15,8 +15,22 @@ import Numbers from "@/widgets/Numbers"; const MainPage = () => { const { setRef } = useContext(RootContext); + const [headerBgUrl, setHeaderBgUrl] = useState(""); useEffect(() => { + // Запрос к WP REST API для поиска медиа по ключу "art" + fetch("https://test.skbkit.ru/wp-json/wp/v2/media?search=art") + .then((res) => res.json()) + .then((data) => { + if (data.length > 0) { + // Берём первый объект и его URL картинки + setHeaderBgUrl(data[0].source_url); + } + }) + .catch((err) => { + console.error("Ошибка загрузки фона с WP:", err); + }); + const navbar = document.getElementById("navbar"); if (navbar) { navbar.classList.add("transparent"); @@ -28,9 +42,17 @@ const MainPage = () => { } }; }, []); + return (
-
setRef(element)}> +
setRef(element)} + style={{ + backgroundImage: + `url(${headerBgUrl})`, + }} + >

Думай иначе, будь креативным!

diff --git a/src/shared/api/useWpMainPageData.ts b/src/shared/api/useWpMainPageData.ts new file mode 100644 index 0000000..333319b --- /dev/null +++ b/src/shared/api/useWpMainPageData.ts @@ -0,0 +1,34 @@ +import { useEffect, useState } from "react"; + +interface AcfField { + mainpage_header_bg?: { + url: string; + }; +} + +interface WpPage { + acf?: AcfField; +} + +export function useWpMainPageData() { + const [bgImage, setBgImage] = useState(""); + + useEffect(() => { + // Заменяй slug на нужный слаг твоей главной страницы в WP + fetch("https://test.skbkit.ru/wp-json/wp/v2/pages?slug=mainpage&_fields=acf") + .then((res) => res.json()) + .then((data: WpPage[]) => { + if (data && data.length > 0) { + const page = data[0]; + if (page.acf && page.acf.mainpage_header_bg) { + setBgImage(page.acf.mainpage_header_bg.url); + } + } + }) + .catch((err) => { + console.error("Ошибка при загрузке данных WP:", err); + }); + }, []); + + return { bgImage }; +} diff --git a/src/shared/assets/images/hard_work_and_creativity/HWaC1.jpg b/src/shared/assets/images/hard_work_and_creativity/HWaC1.jpg new file mode 100644 index 0000000..8d01ded Binary files /dev/null and b/src/shared/assets/images/hard_work_and_creativity/HWaC1.jpg differ diff --git a/src/shared/assets/images/hard_work_and_creativity/HWaC2.jpg b/src/shared/assets/images/hard_work_and_creativity/HWaC2.jpg new file mode 100644 index 0000000..06da681 Binary files /dev/null and b/src/shared/assets/images/hard_work_and_creativity/HWaC2.jpg differ diff --git a/src/widgets/PhotoGallery/PhotoGallery.style.scss b/src/widgets/PhotoGallery/PhotoGallery.style.scss index 06afdb3..cfb48ea 100644 --- a/src/widgets/PhotoGallery/PhotoGallery.style.scss +++ b/src/widgets/PhotoGallery/PhotoGallery.style.scss @@ -89,4 +89,58 @@ $tablet-min-width: 768px; } } +} + +.creativity-section { + display: flex; + flex-wrap: wrap; + gap: 32px; + margin-bottom: 64px; + + .creativity-text-top { + width: calc(50% - 16px); + } + + .creativity-images { + display: flex; + gap: 32px; + width: 100%; + overflow: hidden; + + img { + width: calc(50% - 16px); // по 50% минус половина gap + height: auto; + object-fit: cover; + border-radius: 8px; + pointer-events: none; + } + + @include mediaMax($tablet-max-width) { + flex-direction: column; + + img { + width: 100%; + } + } +} + + @include mediaMax($tablet-max-width) { + flex-direction: column; + + .creativity-text-top, + .creativity-text-bottom, + .creativity-images { + width: 100%; + } + + .creativity-images { + flex-direction: column; + gap: 16px; + } + } +} +.creativity-text-bottom { + margin-left: auto; + width: calc(50% - 16px); + } \ No newline at end of file diff --git a/src/widgets/PhotoGallery/PhotoGallery.tsx b/src/widgets/PhotoGallery/PhotoGallery.tsx index 7535fb3..0416478 100644 --- a/src/widgets/PhotoGallery/PhotoGallery.tsx +++ b/src/widgets/PhotoGallery/PhotoGallery.tsx @@ -3,6 +3,8 @@ import { useMedia } from "@/modules/media/hooks/useMedia"; import { SkeletonGallery } from "@/shared/Components/SkeletonGallery/SkeletonGallery"; import "./PhotoGallery.style.scss" +import HWaC1 from "@/shared/assets/images/hard_work_and_creativity/HWaC1.jpg"; +import HWaC2 from "@/shared/assets/images/hard_work_and_creativity/HWaC2.jpg"; interface PhotoGalleryProps { images?: string[]; @@ -31,6 +33,26 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => { return (
+

Трудолюбие и креативность

+
+
+

+ Проверено опытом: для решения задач, которые перед нами стоят, + важны максимальная вовлеченность в инженерное творчество и желание изменить мир к лучшему, хотя бы вокруг себя. +

+
+
+ + +
+
+

+ Создание чего‑то нового — всегда творческий процесс. Для нас очень важно умение решать возникающие трудности + и находить выход из нестандартных ситуаций. Мы всегда учимся, развиваемся и совершенствуемся. +

+
+
+

Фотогалерея

{filteredMedia.slice(0, visibleCount).map((media) => (