From 13d67ecc317146241db4d22432fe8cf11f5349f1 Mon Sep 17 00:00:00 2001 From: Lanskikh Date: Fri, 12 Jul 2024 14:59:38 +0500 Subject: [PATCH] fixes --- src/assets/efficiency_backlight.svg | 12 +++++++ .../{lightning.svg => vr_backlight.svg} | 0 src/components/Main/Contacts.tsx | 36 +++++++++++++------ src/components/Main/Efficiency.tsx | 22 ++---------- src/components/Main/Teaching.tsx | 2 +- src/components/Main/Trainings.tsx | 12 +++++-- src/ui/AppearanceHr.tsx | 2 +- src/ui/AppearanceText.tsx | 19 ++++++++-- 8 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 src/assets/efficiency_backlight.svg rename src/assets/{lightning.svg => vr_backlight.svg} (100%) diff --git a/src/assets/efficiency_backlight.svg b/src/assets/efficiency_backlight.svg new file mode 100644 index 0000000..ab52765 --- /dev/null +++ b/src/assets/efficiency_backlight.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/lightning.svg b/src/assets/vr_backlight.svg similarity index 100% rename from src/assets/lightning.svg rename to src/assets/vr_backlight.svg diff --git a/src/components/Main/Contacts.tsx b/src/components/Main/Contacts.tsx index 2fbe10c..438f027 100644 --- a/src/components/Main/Contacts.tsx +++ b/src/components/Main/Contacts.tsx @@ -1,3 +1,4 @@ +import { Link } from 'react-router-dom'; import useModalStore from '../../store/modal'; import { Title } from '../../ui/Title'; import ContactsForm from './ContactsForm'; @@ -32,28 +33,43 @@ export function Contacts() {

Свяжитесь с нами

- - +

Социальные сети

- - - +
diff --git a/src/components/Main/Efficiency.tsx b/src/components/Main/Efficiency.tsx index ddda1e8..5489615 100644 --- a/src/components/Main/Efficiency.tsx +++ b/src/components/Main/Efficiency.tsx @@ -11,17 +11,14 @@ export function Effeciency() {
@@ -50,24 +47,9 @@ export function Effeciency() { ); } -function Figure({ - variance, - title, - percents, -}: { - variance: 'left' | 'right'; - percents: number; - title: string; -}) { +function Figure({ title, percents }: { percents: number; title: string }) { return ( -
+
{title} diff --git a/src/components/Main/Teaching.tsx b/src/components/Main/Teaching.tsx index 18d7c15..d70ad44 100644 --- a/src/components/Main/Teaching.tsx +++ b/src/components/Main/Teaching.tsx @@ -3,7 +3,7 @@ import { Title } from '../../ui/Title'; export function Teaching() { return ( -
+
<span className="bg-text-gradient bg-gradient-to-r from-[#798FFF] to-[#D375FF]" diff --git a/src/components/Main/Trainings.tsx b/src/components/Main/Trainings.tsx index 2409ff3..fc74ee3 100644 --- a/src/components/Main/Trainings.tsx +++ b/src/components/Main/Trainings.tsx @@ -2,6 +2,7 @@ import { useHover } from 'usehooks-ts'; import { Title } from '../../ui/Title'; import { useRef } from 'react'; import AppearanceHr from '../../ui/AppearanceHr'; +import { motion } from 'framer-motion'; export function Trainings() { return ( @@ -81,7 +82,14 @@ function TrainingsFeature({ </div> <div className="tablet-figma:flex mobile:max-tablet-figma:hidden"> {hovered && ( - <div className="-my-10 mobile:max-desktop:hidden flex items-center justify-center"> + <motion.div + initial={{ opacity: 0, scale: 0.8 }} + animate={{ opacity: 1, scale: 1 }} + transition={{ + duration: 0.25, + }} + className="-my-10 mobile:max-desktop:hidden flex items-center justify-center" + > <img src={src} alt="" @@ -92,7 +100,7 @@ function TrainingsFeature({ src="src/assets/lightning.svg" alt="" /> - </div> + </motion.div> )} <div className="desktop:hidden flex items-center justify-center"> <img diff --git a/src/ui/AppearanceHr.tsx b/src/ui/AppearanceHr.tsx index c7b62ad..cada997 100644 --- a/src/ui/AppearanceHr.tsx +++ b/src/ui/AppearanceHr.tsx @@ -7,7 +7,7 @@ export default function AppearanceHr({ className?: string; }) { const ref = useRef<HTMLHRElement>(null); - const isInView = useInView(ref); + const isInView = useInView(ref, { once: true }); return ( <hr diff --git a/src/ui/AppearanceText.tsx b/src/ui/AppearanceText.tsx index e42a8ef..aa5d21d 100644 --- a/src/ui/AppearanceText.tsx +++ b/src/ui/AppearanceText.tsx @@ -1,11 +1,20 @@ -import { motion, useScroll, useMotionValueEvent } from 'framer-motion'; +import { + motion, + useScroll, + useMotionValueEvent, + useInView, +} from 'framer-motion'; import { useRef, useState } from 'react'; function AppearanceItem({ text }: { text: string }) { const ref = useRef<HTMLSpanElement>(null); const [isShowed, setIsShowed] = useState(false); - const { scrollY } = useScroll(); + const { scrollY } = useScroll({}); + const isInView = useInView(ref, { + once: true, + margin: `0px 0px -${window.innerHeight / 3}px`, + }); useMotionValueEvent(scrollY, 'change', latest => { setIsShowed( @@ -16,7 +25,11 @@ function AppearanceItem({ text }: { text: string }) { return ( <motion.span ref={ref} - className={'duration-700 ' + (isShowed ? 'opacity-100' : 'opacity-[6%]')} + viewport={{ once: true }} + className={ + 'duration-700 ' + + (isShowed || isInView ? 'opacity-100' : 'opacity-[6%]') + } > {text} </motion.span>