Skip to content

Commit 07a0f4f

Browse files
replace next link with shadcn button, swap refresh function with scroll to top function
1 parent 1dde399 commit 07a0f4f

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

src/components/navigation/NavigationLogo.tsx

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
'use client'
22

3-
import logo from '@/assets/logo.webp'
43
import Image from 'next/image'
5-
import Link from 'next/link'
6-
import { useRouter } from 'next/navigation'
4+
import { Button } from '@/components/ui/button'
5+
import logo from '@/assets/logo.webp'
76

87
const NavigationLogo = () => {
9-
const router = useRouter()
10-
11-
const handleKeyDown = (e: React.KeyboardEvent<HTMLAnchorElement>) => {
12-
if (e.key === ' ') {
13-
e.preventDefault()
14-
router.push('/')
15-
}
8+
const handleScrollToTop = () => {
9+
window.scrollTo({ top: 0, behavior: 'smooth' })
1610
}
1711

1812
return (
19-
<Link
20-
href="/"
21-
onKeyDown={(e) => handleKeyDown(e)}
22-
className="logohomepage flex items-center gap-2 no-underline rounded-lg p-1 pr-2
23-
hover:bg-stone-700 active:bg-stone-600"
24-
aria-label="Back to the Homepage"
25-
title="Back to the Homepage"
26-
>
27-
<Image
28-
src={logo}
29-
width={48}
30-
height={48}
31-
alt="Back to the Homepage"
32-
className="rounded-lg"
33-
loading="lazy"
34-
/>
35-
<span className="max-[336px]:hidden text-large">
36-
Infinite Scroll Feed
37-
</span>
38-
</Link>
13+
<Button asChild variant="ghost" className="px-4 h-fit">
14+
<button
15+
className="text-normal"
16+
aria-label="Scroll back to the the Top"
17+
title="Back to the the Top"
18+
onClick={handleScrollToTop}
19+
>
20+
<Image
21+
src={logo}
22+
width={48}
23+
height={48}
24+
alt="Back to the the Top"
25+
className="rounded-lg"
26+
loading="lazy"
27+
/>
28+
<span className="max-[336px]:hidden text-large">
29+
Infinite Scroll Feed
30+
</span>
31+
</button>
32+
</Button>
3933
)
4034
}
4135

0 commit comments

Comments
 (0)