mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 06:09:45 +00:00
добавлено в о нас блок трудолюбие и креативность, возможность менять фон хедера через worpress, название фона должно быть art
This commit is contained in:
1 parent
7c7f98b448
commit
d3a23dc716
7 files changed
+135
-3
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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 (
|
||||
<div>
|
||||
<div id={styles.mainpageheader} ref={(element) => setRef(element)}>
|
||||
<div
|
||||
id={styles.mainpageheader}
|
||||
ref={(element) => setRef(element)}
|
||||
style={{
|
||||
backgroundImage:
|
||||
`url(${headerBgUrl})`,
|
||||
}}
|
||||
>
|
||||
<section className={styles.container}>
|
||||
<h1>Думай иначе, будь креативным!</h1>
|
||||
<h2>
|
||||
|
||||
@@ -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<string>("");
|
||||
|
||||
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 };
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.2 MiB |
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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 (
|
||||
<div className="mainContainer">
|
||||
<h1 className="title">Трудолюбие и креативность</h1>
|
||||
<div className="creativity-section">
|
||||
<div className="creativity-text-top">
|
||||
<p>
|
||||
Проверено опытом: для решения задач, которые перед нами стоят,
|
||||
важны максимальная вовлеченность в инженерное творчество и желание изменить мир к лучшему, хотя бы вокруг себя.
|
||||
</p>
|
||||
</div>
|
||||
<div className="creativity-images">
|
||||
<img src={HWaC1} />
|
||||
<img src={HWaC2} />
|
||||
</div>
|
||||
<div className="creativity-text-bottom">
|
||||
<p>
|
||||
Создание чего‑то нового — всегда творческий процесс. Для нас очень важно умение решать возникающие трудности
|
||||
и находить выход из нестандартных ситуаций. Мы всегда учимся, развиваемся и совершенствуемся.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 className="title">Фотогалерея</h1>
|
||||
<div className="images">
|
||||
{filteredMedia.slice(0, visibleCount).map((media) => (
|
||||
|
||||
Reference in new issue
Block a user