-
Notifications
You must be signed in to change notification settings - Fork 37
feat: add back to top button #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jpdevhub
merged 5 commits into
jpdevhub:main
from
krishnendu07-code:feature/back-to-top-button
Jun 18, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
85323c1
feat: add back to top button
krishnendu07-code 4794a9b
fix: improve back to top button accessibility
krishnendu07-code 3f5255f
fix: scope back to top button to landing page
krishnendu07-code 2a3d2dc
chore: revert App.tsx formatting changes
krishnendu07-code 495023c
fix: clean up formatting noise and revert destructive changes
jpdevhub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,49 @@ | ||
| import { useEffect, useState } from "react"; | ||
| import { ArrowUp } from "lucide-react"; | ||
|
|
||
| export default function BackToTopButton() { | ||
| const [isVisible, setIsVisible] = useState(false); | ||
|
|
||
| useEffect(() => { | ||
| const toggleVisibility = () => { | ||
| const main = document.querySelector("main"); | ||
|
|
||
| const scrollTop = | ||
| window.scrollY || | ||
| document.documentElement.scrollTop || | ||
| document.body.scrollTop || | ||
| main?.scrollTop || | ||
| 0; | ||
|
|
||
| setIsVisible(scrollTop > 300); | ||
| }; | ||
|
|
||
| window.addEventListener("scroll", toggleVisibility); | ||
| toggleVisibility(); | ||
|
|
||
| return () => window.removeEventListener("scroll", toggleVisibility); | ||
| }, []); | ||
|
|
||
| const scrollToTop = () => { | ||
| window.scrollTo({ | ||
| top: 0, | ||
| behavior: "smooth", | ||
| }); | ||
| }; | ||
| return ( | ||
| <button | ||
| type="button" | ||
| onClick={scrollToTop} | ||
| aria-label="Back to top" | ||
| tabIndex={isVisible ? 0 : -1} | ||
| aria-hidden={!isVisible} | ||
| className={`fixed bottom-20 right-6 z-50 flex h-12 w-12 items-center justify-center rounded-full border border-neon/40 bg-surface-mid text-neon shadow-lg shadow-neon/20 backdrop-blur transition-all duration-300 hover:-translate-y-1 hover:bg-neon hover:text-on-primary hover:shadow-neon/40 focus:outline-none focus:ring-2 focus:ring-neon focus:ring-offset-2 ${ | ||
| isVisible | ||
| ? "translate-y-0 opacity-100" | ||
| : "pointer-events-none translate-y-4 opacity-0" | ||
| }`} | ||
| > | ||
| <ArrowUp className="h-5 w-5" /> | ||
| </button> | ||
| ); | ||
| } | ||
This file contains hidden or 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 GlassCard from "../GlassCard"; | ||
| export default function ScanSkeleton() { | ||
| return ( | ||
| <div className="p-6 space-y-6 animate-pulse"> | ||
| <div className="flex flex-col md:flex-row gap-6"> | ||
| <GlassCard className="flex-1 p-8"> | ||
| <div className="h-4 w-32 skeleton-shimmer rounded mb-4"></div> | ||
| <div className="h-16 w-40 skeleton-shimmer rounded mb-4"></div> | ||
| <div className="h-2 w-full skeleton-shimmer rounded"></div> | ||
| </GlassCard> | ||
|
|
||
| <GlassCard className="md:w-72 p-6"> | ||
| <div className="h-4 w-24 skeleton-shimmer rounded mb-4"></div> | ||
| <div className="h-8 w-full skeleton-shimmer rounded mb-3"></div> | ||
| <div className="h-8 w-full skeleton-shimmer rounded"></div> | ||
| </GlassCard> | ||
| </div> | ||
|
|
||
| <GlassCard className="p-6"> | ||
| <div className="h-5 w-40 skeleton-shimmer rounded mb-4"></div> | ||
| <div className="space-y-3"> | ||
| <div className="h-16 skeleton-shimmer rounded"></div> | ||
| <div className="h-16 skeleton-shimmer rounded"></div> | ||
| <div className="h-16 skeleton-shimmer rounded"></div> | ||
| </div> | ||
| </GlassCard> | ||
|
|
||
| <GlassCard className="p-4"> | ||
| <div className="h-12 skeleton-shimmer rounded"></div> | ||
| </GlassCard> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.