From 061bbeba24f0c9754d1e7a1c88797cf23fc271b3 Mon Sep 17 00:00:00 2001 From: Mohd Faraz Date: Sat, 24 Aug 2024 00:49:37 +0530 Subject: [PATCH] Update the SubDown Logic Signed-off-by: Mohd Faraz --- src/components/SubDown.js | 12 ++++++++---- src/style.css | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/SubDown.js b/src/components/SubDown.js index 17b3ebfeef..eababae776 100644 --- a/src/components/SubDown.js +++ b/src/components/SubDown.js @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useNavigate } from "react-router"; import { HashLink } from "react-router-hash-link"; import DownArrow from "../Assets/down-arrow.svg" @@ -8,9 +8,14 @@ const SubDown = (props) => { const [first, update] = useState(true); const style = { width: "75%", - transform: !first ? 'rotate(180deg)' : '', - transition: 'transform 500ms ease', // smooth transition + animation: "rotation linear", + animationTimeline: "scroll()" } + useEffect(()=> { + window.addEventListener('scroll', () => + console.log(window.scrollY, window.innerHeight) + ) + }, []) return ( el.scrollIntoView({ behavior: "auto" })} @@ -18,7 +23,6 @@ const SubDown = (props) => { onClick={ () =>{ if (!first) { - nav(-1); } update(!first) diff --git a/src/style.css b/src/style.css index 14b8a1318b..75f8bdbf71 100644 --- a/src/style.css +++ b/src/style.css @@ -831,3 +831,9 @@ button:focus { .fork-btn-inner::after { display: none !important; } + +@keyframes rotation { + to { + transform: rotate(180deg); + } +} \ No newline at end of file