Skip to content

Commit 76144d4

Browse files
committed
fix: back-to-top button
1 parent a1b4ec6 commit 76144d4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

components/Footer.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export default function Footer() {
1616
{ label: "Contact", href: "/#contact" },
1717
];
1818

19+
const scrollToTop = () => {
20+
window.scrollTo({
21+
top: 0,
22+
behavior: "smooth",
23+
});
24+
};
25+
1926
return (
2027
<footer className="bg-gradient-to-br from-eo-dark to-eo-teal text-white py-16">
2128
<div className="mx-auto max-w-7xl px-6">
@@ -146,15 +153,15 @@ export default function Footer() {
146153
<p className="text-sm text-white/70">
147154
© {currentYear} Empower Orphans. All rights reserved.
148155
</p>
149-
<Link
150-
href="#top"
151-
className="inline-flex items-center gap-2 mt-4 text-sm text-white/80 hover:text-white transition-colors"
156+
<button
157+
onClick={scrollToTop}
158+
className="inline-flex items-center gap-2 mt-4 text-sm text-white/80 hover:text-white transition-colors cursor-pointer"
152159
>
153160
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
154161
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 10l7-7m0 0l7 7m-7-7v18" />
155162
</svg>
156163
Back to top
157-
</Link>
164+
</button>
158165
</motion.div>
159166
</div>
160167
</footer>

0 commit comments

Comments
 (0)