diff --git a/public/videos/histories/1.mp4 b/public/videos/histories/1.mp4 new file mode 100644 index 0000000..d78a349 Binary files /dev/null and b/public/videos/histories/1.mp4 differ diff --git a/public/videos/histories/2.mp4 b/public/videos/histories/2.mp4 new file mode 100644 index 0000000..13b9398 Binary files /dev/null and b/public/videos/histories/2.mp4 differ diff --git a/public/videos/histories/3.mp4 b/public/videos/histories/3.mp4 new file mode 100644 index 0000000..6dc6636 Binary files /dev/null and b/public/videos/histories/3.mp4 differ diff --git a/src/app/page.tsx b/src/app/page.tsx index 7476464..09d5e23 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -460,7 +460,7 @@ export default function App() { - {/* */} +
diff --git a/src/components/Histories.tsx b/src/components/Histories.tsx index e2ef928..f1be718 100644 --- a/src/components/Histories.tsx +++ b/src/components/Histories.tsx @@ -1,32 +1,48 @@ -import { createRef, useEffect, useLayoutEffect, useState } from "react"; +import { createRef, useEffect, useLayoutEffect, useRef, useState } from "react"; import { useSwipeable } from "react-swipeable"; import ArrowLeftIcon from "./icons/ArrowLeftIcon"; import ArrowRightIcon from "./icons/ArrowRightIcon"; import { Transition } from "react-transition-group"; +import { motion } from "framer-motion"; + +interface IVideo { + id: number; + src: string; + title: string; + desc: string; +} const CARD_COUNT = 3; -const videos = [ +const videos: IVideo[] = [ { id: 1, - src: "videos/video.mp4", - title: "Вся информация о жилом комплексе на одном экране", - desc: "Инструмент продаж graff.estate для проекта LIFE RESIDENCE: новый подход к презентации недвижимости", + src: "/videos/histories/1.mp4", + title: "", + desc: "", }, { id: 2, - src: "videos/video.mp4", - title: "Говно", - desc: "Жопа", + src: "/videos/histories/2.mp4", + title: "", + desc: "", }, { id: 3, - src: "videos/video.mp4", - title: "И в", - desc: "прод", + src: "/videos/histories/3.mp4", + title: "", + desc: "", }, ]; const Histories = () => { + const [isViewportEntered, setIsViewportEntered] = useState(false); + // const [videos, setVideos] = useState([]); + + function handleViewportEnter() { + if (isViewportEntered) return; + setIsViewportEntered(true); + } + const [offset, setOffset] = useState(0); const [videoRefs, setVideoRefs] = useState< React.RefObject[] @@ -96,7 +112,7 @@ const Histories = () => { video.current.pause(); } }); - }, [videoRefs, selectedVideo]); + }, [videoRefs, selectedVideo, isViewportEntered]); useEffect(() => { const currentVideoRef = videoRefs[selectedVideo]; @@ -124,7 +140,10 @@ const Histories = () => { }, [selectedVideo, videoRefs]); return ( -
+
@@ -188,7 +207,7 @@ const Histories = () => { >
-
+

- Вся информация о жилом комплексе на одном экране + {videos[selectedVideo].title}

- Инструмент продаж graff.estate для проекта LIFE RESIDENCE: новый - подход к презентации недвижимости + {videos[selectedVideo].desc}

@@ -241,7 +259,7 @@ const Histories = () => {
-
+ ); };