diff --git a/components/back-to-top.tsx b/components/back-to-top.tsx
new file mode 100644
index 0000000..2ea072f
--- /dev/null
+++ b/components/back-to-top.tsx
@@ -0,0 +1,37 @@
+'use client';
+
+import { useEffect, useState } from 'react';
+
+export function BackToTop() {
+ const [visible, setVisible] = useState(false);
+
+ useEffect(() => {
+ const onScroll = () => {
+ if (window.scrollY > 400) {
+ setVisible(true);
+ } else {
+ setVisible(false);
+ }
+ };
+
+ onScroll();
+ window.addEventListener('scroll', onScroll, { passive: true });
+ return () => window.removeEventListener('scroll', onScroll);
+ }, []);
+
+ if (!visible) return null;
+
+ return (
+
+ );
+}
+
diff --git a/components/layout-shell.tsx b/components/layout-shell.tsx
index ddc1d4a..b1d03c4 100644
--- a/components/layout-shell.tsx
+++ b/components/layout-shell.tsx
@@ -1,6 +1,7 @@
import { SiteHeader } from './site-header';
import { SiteFooter } from './site-footer';
import { RightSidebar } from './right-sidebar';
+import { BackToTop } from './back-to-top';
export function LayoutShell({ children }: { children: React.ReactNode }) {
return (
@@ -13,6 +14,7 @@ export function LayoutShell({ children }: { children: React.ReactNode }) {
+
);
}