-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
2 changed files
with
24 additions
and
0 deletions.
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
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,22 @@ | ||
"use client"; | ||
|
||
import {useWindowScroll} from "@uidotdev/usehooks"; | ||
import Button from "@components/elements/button"; | ||
import {ChevronUpIcon} from "@heroicons/react/20/solid"; | ||
|
||
const BackToTop = () => { | ||
const [{x, y}, scrollTo] = useWindowScroll(); | ||
const showButton = (y && y > 1500); | ||
return ( | ||
<Button | ||
buttonElem | ||
className={"fixed bottom-10 right-10 transition-all duration-300 " + (showButton ? "opacity-100 visible" : "opacity-0 invisible")} | ||
onClick={() => scrollTo({left: 0, top: 0, behavior: "smooth"})} | ||
> | ||
<span className="block flex gap-2"> | ||
<ChevronUpIcon width={30}/>Return to Top | ||
</span> | ||
</Button> | ||
) | ||
} | ||
export default BackToTop; |
118b078
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cardinal-sites-next – ./
cardinal-sites-next-git-main-pookmish.vercel.app
cardinal-sites-next-pookmish.vercel.app
cardinal-sites-next.vercel.app