-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8aeec8
commit 6b4b8c9
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> | ||
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>DecenTrade | NFT Marketplace</title> | ||
</head> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import "../styles/ScrollToTop.css"; // Import the CSS file | ||
|
||
const ScrollToTop = () => { | ||
const [isVisible, setIsVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
const toggleVisibility = () => { | ||
if (window.scrollY > 100) { | ||
setIsVisible(true); | ||
} else { | ||
setIsVisible(false); | ||
} | ||
}; | ||
|
||
window.addEventListener("scroll", toggleVisibility); | ||
return () => window.removeEventListener("scroll", toggleVisibility); | ||
}, []); | ||
|
||
const scrollToTop = () => { | ||
window.scrollTo({ top: 0, behavior: "smooth" }); | ||
}; | ||
|
||
return ( | ||
isVisible && ( | ||
<div className="scroll-top" onClick={scrollToTop}> | ||
<i className='bx bx-chevron-up arrow-up'></i> | ||
</div> | ||
) | ||
); | ||
}; | ||
|
||
export default ScrollToTop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.scroll-top { | ||
height: 60px; | ||
width: 60px; | ||
position: fixed; | ||
bottom: 10px; | ||
right: 20px; | ||
margin-right: 60px; | ||
padding: 10px; | ||
cursor: pointer; | ||
display: none; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 50%; | ||
background: linear-gradient(90deg, #4a90e2, #9013fe); | ||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); | ||
animation: float 2s ease-in-out infinite; | ||
} | ||
|
||
.scroll-top:hover { | ||
background: linear-gradient(90deg,#9013fe, #4a90e2); | ||
animation-play-state: paused; | ||
} | ||
|
||
.scroll-top i { | ||
font-size: 40px; | ||
font-weight: 700; | ||
color: #fff; | ||
} | ||
|
||
@keyframes float { | ||
0% { | ||
transform: translateY(0); | ||
} | ||
50% { | ||
transform: translateY(-10px); | ||
} | ||
100% { | ||
transform: translateY(0); | ||
} | ||
} |