Skip to content

Commit

Permalink
Update the SubDown Logic
Browse files Browse the repository at this point in the history
Signed-off-by: Mohd Faraz <[email protected]>
  • Loading branch information
AndroiableDroid committed Aug 23, 2024
1 parent 2f63fb3 commit 061bbeb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/SubDown.js
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -8,17 +8,21 @@ 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 (
<HashLink
scroll={(el) => el.scrollIntoView({ behavior: "auto" })}
to={props.id}
onClick={
() =>{
if (!first) {

nav(-1);
}
update(!first)
Expand Down
6 changes: 6 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,9 @@ button:focus {
.fork-btn-inner::after {
display: none !important;
}

@keyframes rotation {
to {
transform: rotate(180deg);
}
}

0 comments on commit 061bbeb

Please sign in to comment.