From 65680eb8612219c00971c8fbd511c6b4fb34872f Mon Sep 17 00:00:00 2001 From: Lanskikh Date: Mon, 23 Sep 2024 13:35:50 +0500 Subject: [PATCH] upd products --- .../Main/Products/Tabs/ForTeachingTab.tsx | 74 +++++++++++++------ .../Main/Products/Tabs/IndustrialTab.tsx | 50 ++++++++++--- .../Main/Products/Tabs/SimulatorsTab.tsx | 68 +++++++++++++---- src/components/Main/Teaching.tsx | 2 +- 4 files changed, 147 insertions(+), 47 deletions(-) diff --git a/src/components/Main/Products/Tabs/ForTeachingTab.tsx b/src/components/Main/Products/Tabs/ForTeachingTab.tsx index 6b35ad4..cc9a8cb 100644 --- a/src/components/Main/Products/Tabs/ForTeachingTab.tsx +++ b/src/components/Main/Products/Tabs/ForTeachingTab.tsx @@ -1,8 +1,20 @@ import { useRef } from 'react'; import { getIcon } from '../../../../utils/getIcon'; -import { useInView } from 'framer-motion'; +import { motion, useInView } from 'framer-motion'; export function ForTeachingTab() { + const titleRef = useRef(null); + + const titleInView = useInView(titleRef, { once: true, amount: 'all' }); + + const textRef = useRef(null); + + const textInView = useInView(textRef, { once: true, amount: 'all' }); + + const imgRef = useRef(null); + + const imgInView = useInView(imgRef, { once: true, amount: 'all' }); + return (
-
+

Интерактивные тренажеры для учебных заведений

03

-
+
@@ -30,22 +48,35 @@ export function ForTeachingTab() { поломки оборудования, а также экономить на расходных средствах" type="labs" /> -

+ Оснащение учебных классов и центров всем необходимым для современного обучения под «ключ» -

+
- обучение - обучение + + обучение + обучение +
); @@ -61,23 +92,24 @@ function ForTeachingOption({ type: 'labs' | 'teaching'; }) { const ref = useRef(null); - const isInView = useInView(ref, { - margin: `0px 0px ${(ref.current?.clientHeight ?? 0) - window.innerHeight}px`, - }); + const inView = useInView(ref, { once: true, amount: 'all' }); return ( -
{getIcon(type, true, 'max-sm:hidden min-w-11')}
- {getIcon(type, isInView, 'sm:hidden min-w-11')} + {getIcon(type, inView, 'sm:hidden min-w-11')}

{title}

{description}

-
+ ); } diff --git a/src/components/Main/Products/Tabs/IndustrialTab.tsx b/src/components/Main/Products/Tabs/IndustrialTab.tsx index fbeb211..cd9ab6e 100644 --- a/src/components/Main/Products/Tabs/IndustrialTab.tsx +++ b/src/components/Main/Products/Tabs/IndustrialTab.tsx @@ -1,24 +1,31 @@ import { useRef } from 'react'; import { getIcon } from '../../../../utils/getIcon'; -import { useInView } from 'framer-motion'; +import { motion, useInView } from 'framer-motion'; function TeachingItem({ title, text, iconType, + index, }: { title: string; text: string; iconType: 'danger' | 'service' | 'safety'; + index: number; }) { const ref = useRef(null); - const isInView = useInView(ref, { - margin: `0px 0px -${window.innerHeight - (ref.current?.clientHeight ?? 0)}px`, + const rootInView = useInView(ref, { + once: true, + amount: 'all', + // margin: `0px 0px -${window.innerHeight - (ref.current?.clientHeight ?? 0)}px`, }); return ( -
- {getIcon(iconType, isInView, 'sm:hidden min-w-11')} + {getIcon(iconType, rootInView, 'sm:hidden min-w-11')}

{title}

{text}

- + ); } export function IndustrialTab() { + const titleRef = useRef(null); + + const titleInView = useInView(titleRef, { once: true, amount: 'all' }); + + const imgRef = useRef(null); + + const imgInView = useInView(imgRef, { once: true }); + return (
-
+

Промышленные тренажеры

01

-
+
-
+ тренажеры -
+
); diff --git a/src/components/Main/Products/Tabs/SimulatorsTab.tsx b/src/components/Main/Products/Tabs/SimulatorsTab.tsx index 4f169df..712b184 100644 --- a/src/components/Main/Products/Tabs/SimulatorsTab.tsx +++ b/src/components/Main/Products/Tabs/SimulatorsTab.tsx @@ -1,12 +1,33 @@ -function SimulatorsItem({ text }: { text: string }) { +import { motion, useInView } from 'framer-motion'; +import { useRef } from 'react'; + +function SimulatorsItem({ text, index }: { text: string; index: number }) { + const ref = useRef(null); + + const isInView = useInView(ref, { once: true, amount: 'all' }); + return ( -
+ {text} -
+ ); } export function SimulatorsTab() { + const titleRef = useRef(null); + + const titleInView = useInView(titleRef, { once: true, amount: 'all' }); + + const imgRef = useRef(null); + + const imgInView = useInView(imgRef, { once: true, amount: 'all' }); + return (
-
+

Симуляторы управления техникой

02

-
+
- - - - - - + + + + + +
-
+ -
-
+ + -
+
); diff --git a/src/components/Main/Teaching.tsx b/src/components/Main/Teaching.tsx index adf8f34..40eebd1 100644 --- a/src/components/Main/Teaching.tsx +++ b/src/components/Main/Teaching.tsx @@ -90,7 +90,7 @@ function TeachingFeaturesForDesktop() { /> Видеозапись обучения